Monday, 10 June 2019

ORA-12560: TNS:protocol adapter error


Have ever wondered why, for some weird reason you get an error like ORA-12560: TNS:protocol adapter error.

If so, then let me give you a couple of reasons for this error.

The easiest reason from the top of my head right now and for most will be that the oracle services are down and so, needs to be started.

Start all oracle services (or more precisely the listener service and oracle service)

So to start oracle services from your keyboard type windows + run and enter services.msc as shown below.





this will load the services management console, locate all services that start with "oracle" and start them (the keys ones are usually the listener and the oracle service, the rest are really optional) as shown below.
and voila you are done. Error Fixed
While this solution may work for some people, it may not work for you.
if that's the case you will need to think hard when was the last time you were able to launch/start your oracle database via sqlplus, were there any programs installed from that time that you think may have caused the issue. if so, a simple "uninstallation" will fix the issue.
Case in point:

Installation of oracle client. (not for you it could be MS SQL)
if you installed oracle 12c on your system and later install oracle client version 11 then you will likely have the ORA-12560: TNS:protocol adapter error.
this is so because both application will create an environment path on your computer environment variables (right-click my PC or my computer and click properties >> click advanced properties >> environment variables >> path)
one for your oracle 12c installation 
and the other for your oracle client 11g
since oracle 11g was installed after, it will likely be the first entry on your environment variables or at the very least be ahead of the oracle 12c path, so when you launch your database via sqlplus
it will launch the version 11 of sqlplus, its assuming that the sqlplus on the system is version of 11 instead of 12c.
and so when it tries to connect to the database as sysdba, it will try to connect using the TNS listener for oracle 11g, obviously this will fail as TNS listener v11 is not installed.
so the solution to this issue will be to
1) unsinstall the oracle client or 
2) simply change the order level of the oracle path, let the oracle 12c path come before oracle 11g path as shown below:
So oracle 12c path has been moved up.
and voila if you launch your sqlplus via cmd prompt it will work now as shown below


or sometimes just resetting the oracle home path might just do the trick, i recently had this same error popped up again, i restarted all services, "still a no show" i simply went to the environment variables and i moved the oracle path (..../12.2.0/....) downwards and i saved it. then restarted cmd and relaunch sqlplus and "poof" it worked!!!.




  Article Written By:  Ogonna Ifepe for Wapsoft Technologies Enterprise

No comments:

Post a comment