Wednesday, November 7, 2012

ORA-12154: TNS:could not resolve the connect identifier

This is the most common error which we are finding these days and it creates a havoc among the users who are working with Oracle. It is mainly because of some setting issues or some configuration issues, which cause this and our www has a numerous solution to this problem.

Most of them stating the same solution and workaround for the problem. But most of the times, we had all this and the problem still exists. Solution to that is the user should cool down himself first and then again retry with the available solution because sometimes we tend to skip some points/check from the solution.

Few of the sites, from which I got my solution is :-

http://www.dba-oracle.com/t_ora_12154_tns_resolve_service_name.htm

http://ora-12154.ora-code.com/

But, today I have found one more probable cause for this. In my case, it was the Unix machine and access permission in that was causing me this error.

Scenario :- I was having oracle installed in one of  the Unix machine and  only oracle user was having full rights in the oracle/db folder and other users have only read access. When other users are trying to access the user created in Oracle, it was giving a "tns :12154" error.

Solution :-
The "tnsnames.ora" was not granted full access ( read, write, execute ) to other users who were trying to access the database.

So, the solution is chmod 777 tnsnames.ora and then try again with the user. It may solve your problem.



Enjoy Testing and keep Sharing :)

Tuesday, October 23, 2012

Excel macro to copy the contents from one worksheet to another

Few months back, i was calculating out my monthly expenses and thought of using excel for keeping the track of records. I felt that it was 'OK' and probably I can copy the same sheet for the coming months and then a rename and some tweaking will serve my purpose.

After one or two months, I got bored by this activity [ selecting the worksheet and then copying the contents to a new worksheet ] Then an idea crept to my mind "why don't i use the excel macro and do the same thing" instead of doing it manually.

So, here is the code for that :-
I have One worksheet with two sheets ( Template, Standard ). "Template" is the sheet which is having a set of well defined expenses and "Standard" is the sheet having the button using which i can create a new sheet.
"How to insert a button in excel ?" [ " Next Month " is the button name in my case ]


The macro which is to be added for this is :-

**************************************************
Private Sub Next_Month_Click()

Dim SheetVar As Worksheet
' Application.DisplayAlerts = False


For Each SheetVar In ActiveWorkbook.Worksheets
   
    If SheetVar.Name = Format(Now, "mmmm_yyyy") Then
       
        MsgBox (" The Sheet already exist")
        End
        
     End If
       
Next SheetVar

myWorksheetName = Format(Now, "mmmm_yyyy")

Sheets("Template").Copy After:=ActiveSheet
ActiveSheet.Name = myWorksheetName
Sheets(myWorksheetName).Activate

End Sub
**************************************************

So, this will solve the purpose of adding the sheet and if the sheet is already present then this will give a message that " The Sheet already exist"

Enjoy :)
Enjoy Testing and Keep Sharing



Thursday, August 30, 2012

Tomcat : Failed to start connector [Connector[HTTP/1.1-0]]

Most of the times when starting a tomcat server, we face many problems. Most of the times, the problems are because of some settings which are done to some of the files and it stops working.

The best way to solve this problem is to either trouble shoot for the problem or replace the tomcat with a new one and then re-deploy the application.

In case of troubleshooting, if you are getting some error like this :-
"Failed to start connector [Connector[HTTP/1.1-0]]"

then, it may be because of some port clash or the tomcat is already running by some other user or the tomcat was not stopped properly or some changes which are done in the deployment/web.xml file or some changes in the bin/statup or bin/catalina

For troubleshooting these fields check for the following things :-

1. Change the port no. from the conf/server.xml and then again launch the tomcat

2.  To check if tomcat is already running, then go to task manager in windows and search for the Java.exe files, if any process with java.exe is running by some other user, then kill that process and then again check

3. Check for the new settings which are done in "deployment/web.xml". Remove those and then check again

4. For the changes in "startup" or "Catalina" file, check if you have defined the "CATALINA_OPTS" or "JAVA_OPTS" incorrectly in any of the line. Or remove the "CATALINA_OPTS / JAVA_OPTS" settings done by you and then check if tomcat is starting or not.

I think any of these would help you solve the problem of starting the tomcat.

Happy Testing and Keep Sharing :-)

Thursday, August 23, 2012

Unix : Create multiple folder in a single command

Sometimes it becomes tedious to create multiple folders inside one folder and typing all those stuffs again and again make you bored or you get a feeling of machines :-)

So, here there is a easy way to fix this problem.
Suppose you wish to create the following structure :-

        Test                                     TestA                              work          logs
            |___ Test01                         |___ TestA01
            |___ Test02                         |___ TestA02
            |___ Test03                         |___ TestA03
            |___ Test04

Now, creating all these things in one go becomes easy by one of the simple unix command.

root> mkdir -p Test/{Test01,Test02,Test03,Test04} TestA/{TestA01,TestA02,TestA03} work logs
root> ls
Test  TestA  logs  work

Hope this helps and will make your work easy.

Saturday, January 28, 2012

How to store value using ftp

FTP [File Transfter protocol] is an inbuild facility which helps user to connect to some remote server. It is basically used for copying and getting files to and fro from one machine to other machine. Some common commands which work for FTP are get, put, mget, mput, bin, ls, lcd, cd, bye etc

If you want to automate FTP using some scripts and want to store values which are generated in ftp prompt to a file or variable, then here is the right method/way to do the same.

Storing a FTP contents into a variable

Test
  |___ 23-01-12
  |___ 24-01-12
  |___ 25-01-12
  |___ 26-01-12
  |___ 27-01-12

Suppossing a scenario where in we have a test folder containing following sub folder [ where these folders are getting updated dailiy ]. So, how to take the value of the latest folder ????

ftp>cd /home/test   { this will change the directory to "test" }
ftp> ls
23-01-12
24-01-12
25-01-12
26-01-12
27-01-12
ftp> ls 1.txt     { this will copy all the contents of ls into the file 1.txt and the file will be placed at the same location from where ftp is being launched, the default for windows is "C:\Documents and Setting\{username}"

*****************************************
Check the above location and you will find a new file "1.txt" will be created and it will have all the values which comes out as a part of "ls"

Hope this would help you capture some information.

Happy Testing :-)