Skip to Main Content
  • Questions
  • ORA-12560: TNS:protocol adapter error ... archives aren't helping

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Ross.

Asked: April 25, 2016 - 11:35 pm UTC

Last updated: April 26, 2016 - 5:57 pm UTC

Version: 11.2g

Viewed 1000+ times

You Asked

I'm new to Oracle and SQL. I'm currently enrolled in a course but cannot complete my assignment because of the ORA-12560: TNS: protocol adapter error.

I believe that I have set the correct PATH.

The assignment:
Before you create a new database, you will need a profile (PFILE) in the directory from which you are running sql*plus. This file, initTEST.ora, contains the single line db_name=TEST. This will create the simplest database possible. You also need to SET ORACLE_SID=TEST at the command prompt, before running SQLPLUS / as sysdba. You will know you started the correct instance if it says, "Connected to an idle instance." Don't forget to SPOOL c:\cis421b\S4spool.txt as soon as you sign into sql*plus.

I have added the mentioned PFILE to the bin director that has sql*plus already.

What I have tried:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\r_staadecker>cmd
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\r_staadecker>SET ORACLE_SID=TEST

C:\Users\r_staadecker>SQLPlus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 25 13:52:12 2016

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

ERROR:
ORA-12560: TNS:protocol adapter error


Enter user-name:
ERROR:
ORA-12560: TNS:protocol adapter error


Enter user-name: sqlplus / as sysdba
Enter password:
ERROR:
ORA-12560: TNS:protocol adapter error


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

C:\Users\r_staadecker>SET ORACLE_SID=TEST

C:\Users\r_staadecker>SQLPLUS / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 25 14:00:21 2016

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

ERROR:
ORA-12560: TNS:protocol adapter error


Enter user-name: sys / as sysdba
Enter password:
ERROR:
ORA-12560: TNS:protocol adapter error


Enter user-name: SYS/Oracle11 as sysdba
ERROR:
ORA-12560: TNS:protocol adapter error


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

C:\Users\r_staadecker>SET ORACLE_SID=TEST

C:\Users\r_staadecker>sql*plus / as sysdba
'sql*plus' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\r_staadecker>sql*plus SYS/Oracle11 as sysdba
'sql*plus' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\r_staadecker>SQLPLUS / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 25 14:03:51 2016

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

ERROR:
ORA-12560: TNS:protocol adapter error


Enter user-name: oracle
Enter password:
ERROR:
ORA-12560: TNS:protocol adapter error


Enter user-name: oracle
Enter password:
ERROR:
ORA-12560: TNS:protocol adapter error


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

C:\Users\r_staadecker>SET ORACLE_SID=TEST

C:\Users\r_staadecker>sys / as sysdba
'sys' is not recognized as an internal or external command,
operable program or batch file.


Any help would be greatly appreciated but please be patient due to the novice stage I'm in.

and Connor said...

To create a database on Windows, the first thing that is needed to create a Windows service that will control it. Without that, you always get the TNS error.

A good thing to do, is run Database Configuration Assistant, and walk through all the GUI steps...but once you get to the end, tick the "Generate Scripts" option and turn off the "Create Database" option.

Then you can review the scripts and see what we run internally on Windows to create a database. You'll see one of the first things we do is run a program called ORADIM to create a Windows service. After that, *then* we can create the database using SQL Plus etc.

Let us know how you go - we're happy to help you along the way as you explore.

Is this answer out of date? If it is, please let us know via a Comment