Записки на полях внедрения
Блог по IT-технологиям и управлению проектами.
Project Management, PMP, PMI, PMBOK; Oracle (Database, Identity Manager, SOA Suite, BI, Access Manager, Weblogic, Internet Directory); Linux/Unix, Windows; OSS/BSS, Identity Management; Perl, PHP; MySQL, MSSQL; UML, IDEF; Agile, RUP/AUP; PL/SQL, C++; TFS; Java, JSF, Spring, OSGi, Hibernate, MVC, JSP, IoC, RMI, EJB, JMS, AOP, Apache Struts, Apache Felix, Apache Tomcat, AJAX, Jetty, JSON, XML, XSD, WSDL, SOA; AD, Exchange; SAP
ORA-12560: TNS:protocol adapter error
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ORA-12560: TNS:protocol adapter error
I do not have tnsnames.ora as it’s my local.
E:\>set oracle_sid = TEST123
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 16 14:44:06 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ORA-12560: TNS:protocol adapter error
Answers

Why did you use 11.2.0.1? That’s very outdated now, It’s not the problem but you ought to be using 18.5 if you’re starting afresh (or 18.6 if it arrives this week).
First step is to make sure the service has started, from powershell you can do:
Second step is to use set properly, you must not use whitespace:
Third step is to specify the sysdba role when you want to connect as sys, if you’re using OS authentication (the default), you would just do
sqlplus / as sysdba
But since you’ve already created sample schemas you should be connecting as one of those:
ORA-12560: TNS:protocol adaptor error

I Google[d] for this error ORA-12560: TNS:protocol adaptor error but not able to find the actual reason and how to solve this error ?
Can anyone tell me a perfect solution to solve login problem.
19 Answers 19
-
Go to the windows machine that hosts the Oracle database server
Go to Start -> Run -> Services.msc in Windows. Locate OracleService < SID > (here OracleServiceORCL ) and click on Start to start the oracle database service (if not already running) 
Once it is up and running, from the command prompt run the following:
(tnsalias entry you can find it in tnsnames.ora file)
In my case I didn’t have an OracleService (OracleServiceORCL) in Windows Services.msc as described in Bharathi’s answer.
I executed this command:
and then the OracleService called OracleServiceORCL just showed up and got started in Services.msc. Really nice.
Seems like database is not up. It might be due to restarting machine and the instance is not set to autostart and it so not started munually after starting from services Screen.
Just goto Command prompt
Set Oracle SID C:>set oracle_sid=ORCL
Now run Net start command. C:>net start oracleserviceORCL
Add to the enviroment vars the following varibale and value to identify the place of the tnsnames.ora file:
from command console, if you get this error you can avoid it by typing
then you can connect
In my case (for OracleExpress) the service was running, but I got this issue when trying to access the database via sqlplus without connection identifier:
To make it work I needed to add the connection identifier (XE for Oracle Express), so following command worked ok: