Sunday, January 25, 2009

ORA-12557: TNS:protocol adapter not loadable

Problem Description
In my machine I had oracle 10g home , using sqlplus of 10g I could connect to an Oracle database 10g. Now I have installed a new oracle 11g home, but using sqlplus of 11g I could not connect to Oracle database 10g. Below is an example,

With 10.2g sqlplus I can connect to 10g database.
C:\>e:\oracle\product\10.2.0\db_1\bin\BIN\sqlplus.exe maximsg/a@192.168.100.160/tiger

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 26 01:54:10 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

With 11g sqlplus I could not connect to oracle database 10g. It returns error message, ORA-12557: TNS:protocol adapter not loadable.
C:\>d:\app\oracle\BIN\sqlplus.exe maximsg/a@192.168.100.160/tiger

SQL*Plus: Release 11.1.0.6.0 - Production on Mon Jan 26 01:55:00 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

ERROR:
ORA-12557: TNS:protocol adapter not loadable

Cause of the Problem
The problem happens because of two ORACLE_HOME are installed on your system. As after 10g you hav e installed 11g so whenever you write sqlplus by default new 11g binaries are selected and raises ORA-12557. But working with old home 10g works fine.

Simply sqlplus does not work but 10g home location sqlplus (e:\oracle\product\10.2.0\db_1\bin\BIN\sqlplus.exe ) works.

C:\>sqlplus.exe maximsg/a@192.168.100.160/tiger

SQL*Plus: Release 11.1.0.6.0 - Production on Mon Jan 26 22:47:08 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

ERROR:
ORA-12557: TNS:protocol adapter not loadable

Connecting to old oracle database using new binaries are not supported in oracle and error will return.

Solution of the Problem
Only setting ORACLE_HOME is not sufficient on windows environment. Because the location is taken from windows registry. So either uninstall newer oracle home or explicitly pointing to old oracle binaries will solve the problem.

Here using pointing to old home,
C:\>e:\oracle\product\10.2.0\db_1\bin\BIN\sqlplus.exe maximsg/a@192.168.100.160/tiger

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 26 01:54:10 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Alternatively you can follow below.

Step 01: Remove registry entries of new ORACLE_HOME.
To do this,
i)Type regedit on Run.
ii)Press enter and expand HKEY_LOCAL_MACHINE.
iii)Then expand SOFTWARE and then expand ORACLE tab. There you will see two oracle home. Right click on the one that you want to delete and then select delete. If prompting click yes.

Step 02: Remove any environmental variable.
i)Right click on My computer icon. Then select properties.
ii)System properties window will appear. Click on Advanced tab.
iii)Select environmental variables.
iv)Find the variable/system variable path and ORACLE_HOME. Edit or modify them so that it point to you desired sql*plus.
Usually in the PATH system variable you will get both ORACLE_HOME path. Just remove one path. Of course if you have ORACLE_HOME variable settings first delete the key.

13 comments:

Raja said...

looks good..

Jin said...

Good Work..Helped me to solve my issue.. Thanks a lot..

GITDBAgroup said...

Greate......helped me to solve my issue.... Thankyou very much!!!

Sanjay said...

Good one Arju.

A couple of observations.

This issue occurs if you install OAS after Oracle 11g, also.

The easiest way out is to modify the environment variable, putting the 11g bin folder as first entry in the PATH variable.

nileshnature said...

I was aslo facing the same problem.

I am writting what I did to solve this problem.

I unistalled the newly installed oracle home and reistalled the oracle and place the tnsnames, listner and sqlnet files from old home to newer home...
It works for me.. u people also try this :)

Anonymous said...

Solved my problem - thx for pointing me to the right direction.

Anonymous said...

Thanks, it solved my problem.

Anonymous said...

Thank you, it resolved my problem.

Anonymous said...

I had Oracle 10G Enterprise Edition and Oracle 11G Client both installed on the same server. I could not start my ArcSDE Service (to Oracle 10G) until the 11G client was uninstalled. Working fine now. Thanks for the steps.

Anonymous said...

thank you

khursheed alam khan said...

See Boss!

It is very simple
1)u copy all datafiles,control file,
redologfile,dbs folder,dbms folder
from the existin oracle database
2)uninstall and install a new database
3)place above files/folders on respective places
4) login and start the database
It is working fine.

If any while doing this process please mail me the error screen shots
@khanmsp@gmail.com

Thanks,
Bye.

Anonymous said...

I had the following scenario:
Manually installed Oracle10g (10.2.0.5.0) client, and subsequently had an SMS package that installed the Oracle9i (9.2.0.6.0) client.
To resolve my problem, the PATH environment variable had Ora10g first and Ora9i second (since I wanted everyone to use the Oracle10g binaries to connect to my ORACLE10 databases). When I ran a command prompt and entered "set | sort", it reported my environment variables. TNS_ADMIN environment variable value was "C:\Ora10g\NETWORK\ADMIN" which was correct, but my ORACLE_HOME environment variable value was "C:\Ora9i". This was the problem. I changed the ORACLE_HOME environment variable value to "C:\Ora10g" and this resolved my problem.

Anonymous said...

Faced this same error after migrating an AIX 5.3 LPAR from one system to another. "/tmp" was left out of the 'mksysb' to conserve space. It turns out that, at least on AIX, there must be a /tmp/.oracle directory which the DBA account or group must have RWX perms on. After creating the directory and setting ownership/perms, the listener started right up.