sqlplus Error: ORA-12560: TNS:protocol adapter error

Again I am fairly new to Oracle so it has been quite a learning process and typically I have been running into errors that are easy to resolve but being able to locate the answers easy has been challenging. While attempting to use sqlplus.exe from the Windows 7 command line I continued to receive a TNS protocol adapter error and it turns out it was simply from using the incorrect syntax. Below I describe the error in more detail as well as the correct syntax to use for sqlplus on Windows 7.

SQLPlus Error On Windows 7 Computer Running Oracle:

C:Program Files (x86)instant-client>sqlplus system/password

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 17 01:16:30 2011

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

ERROR:
ORA-12560: TNS:protocol adapter error

Enter user-name:
C:Program Files (x86)instant-client>

As you can see above I was receiving the ORA-12560: TNS: protocol adapter error. After some initial research I was baffled at what the issue could be as there appear to be numerous reasons this could be an issue including services not being started properly, incorrect environment variables, etc. Turns out in my case it literally was just a syntax error on my part. Somehow I had tried a half dozen syntax combinations but never fully read through the “–help” screen which is what ended up solving my issue. Use the below syntax to login to Oracle using sqlplus on a Windows 7 computer.

Correct sqlplus Login Syntax For Oracle On Windows 7:

C:Program Files (x86)instant-client>sqlplus.exe system/password@localhost/ORC

SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 17 01:15:24 2011

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 6
bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:Program Files (x86)instant-client>
sqlplus.exe system/password@localhost/ORC

As you can see above the correct syntax is fairly easy but any deviations will leave you with the TNS protocol adapter error. Below are the descriptions of each part of the sqlplus command above.

  • sqlplus.exe – the actual sqlplus command
  • system – username
  • / – separator between username and password
  • password – the password to the username
  • @ – separator between password and hostname
  • localhost – the host running Oracle
  • / – the separator between the Oracle host and the SID
  • ORCL – service name or SID

Hopefully the reason you were receiving the TNS protocol adapter error was as simple as the reason above and if so have fun using sqlplus!


List Price: $9.95 USD
New From: $3.59 USD In Stock
Used from: $0.01 USD In Stock


List Price: $39.95 USD
New From: $19.99 USD In Stock
Used from: $2.42 USD In Stock

Share