SQLPLUS / AS SYSDBA failed to login ORA-12560 - oracle

I am getting
ERROR:
ORA-12560: TNS:protocol adapter error
adapter error when attempt to login as SYSDBA. I did some research and find that firstly in Windows services there weren't any of the OracleJobSchedulerdb12gr1; OracleServicedb12gr1 .. e.t.c.
So I did add them and start:
C:\Windows\system32>oradim -new -sid db12gr1
So I start a listener as well:
C:\Windows\system32>lsnrctl start
And after that when I check the status I get:
C:\Windows\system32>lsnrctl status
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "XE" has 1 instance(s).
Instance "XE", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
Not sure if the UNKNOWN is the problem I dropped every other SID_LIST_LISTENER from listener.ora and the LISTENER looks like this (in listener.ora) :
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
Also I have set my ORACLE_HOME to env vars correctly and added to Path the bin folder so I can access sqlplus. Defining ORACLE_SID (set ORACLE_SID=localhost) does not made any difference before I try to log as sysdba. Also I was able to start the services and start listener only from command prompt opened as administrator of course where still I can't sqlplus / as sysdba.
tnsnames.ora:
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
I am really out of ideas. Anyone aware what might cost this ?
PS: OS: Windows 10 ; Oracle : 12c

You have to set your ORACLE_SID environement variable to the right value:
set ORACLE_SID=db12gr1
and make sure your instance service is correctly started.

lets do this:
1. Open Oracle Net Configuration Assistant
2. Select radio button option at Local Net Service Name Configuration, then click Next
3. Select radio button option at Reconfigure, then click next
4. Select net service name you want to reconfigure, either ORACLR_CONNECTION_DATA or ORCL, then click Next
5. input your Service Name, if your service name of installed oracle as ORCL, then write ORCL to the field, then click Next
6. select the protocol you want to use, for example, select TCP, then click Next
7. input hostname where your oracle database engine (service) installed, for example, installed on your desktop or notebook,
then fill as localhost, and fill your port number (select option Use the Standar port number of 1521) or if use other port, fill the port number
Then click next.
8. select Yes perform test,
if necessary, change user logon
then click next
9. if no configure another net service name, select No and then click next
10. Click Finish
you should download, extract and install the ODTwithODAC183.zip and BuildTools_Full.exe if you want use to connect on .net framework from MS Visual Studio

Related

How do I solve error 12505 in Oracle SQL?

I'm a programming student and I just began learning databases and SQL. When I try to connect to the databse in SQL Developer it says
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor.
I tried to install it on my PC tower at home and everything works fine it just doesn't work with my laptop. Even the teacher said he couldn't help me because he doesn't know what to do so I try here because I really don't know what to do.
I tried uninstalling et reinstalling the database multiple times and I made sure every Oracle services were running. My SID is set to XE. My connection is set to basic. The host is 'localhost', the port is '1521' and the SID is 'xe'
Heres is the tnsnames.ora file
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-62JIG0N)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
Heres is the ouput of lsnrctl status in the cmd
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Production
Start Date 03-F╔VR.-2020 12:04:38
Uptime 0 days 4 hr. 53 min. 38 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\listener.ora
Listener Log File C:\oraclexe\app\oracle\diag\tnslsnr\DESKTOP-62JIG0N\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DESKTOP-62JIG0N)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Here's the listener.ora file
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-62JIG0N)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
What is the 'connection' type of your SQL Dev connection properties? (basic? TNS?) There is a discconect between the error message ("NS:listener does not currently know of SID") while your tnsnames says to connect by service name rather than by SID. This would indicate that your SQL Dev connection type is 'basic' . . . which doesn't use tnsnames.ora at all. Since you are using a 'basic' connection, you need to show us the values used. Also, since it is the listener complaining that he doesn't know of the sid you are requesting, you need to show us the output of the command 'lsnrctl status', so that we can see what the listener does know about.
This really a pretty basic problem, so the fact that your instructor doesn't know how to solve it leaves me with a lot of questions about his qualifications to be teaching anything involving oracle.

Able to access Oracle database by localhost not by IP address

I have installed Oracle 11g and for test purpose I have connected to the database using an editor( called DBeaver).
When host name is provided a localhost ,it connects .But when host name is provided as the IP of the system ,the editor fails to connect and displays following message.
IO Error: The Network Adapter could not establish the connection
The Network Adapter could not establish the connection
java.net.ConnectException: Connection refused: connect
I have tried changing the listener.ora from
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
to
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.0.3)(PORT = 1521))
)
)
Here I have replaced localhost with IP i.e. 10.140.0.3.
But so far unable to connect it .
Can anybody share some experience on this ?
Your listener.ora entry is incorrect .It should be like the following.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.0.3)(PORT = 1521))
)
)
To avoid mistakes related to manual edit, use Net manager and add the address from there .
Check the following screenshots to make the listener.ora file related changes .
Open Oracle Net Manager
Add IP address to the Listener
Once the changes are done, do not forget to save it from Oracle Net Manager !
you can install Oracle Database on a computer that has a IP addresses.
IP address is associated with a host name; you can set up aliases for the host name.
By default, Oracle Universal Installer uses the ORACLE_HOSTNAME environment variable setting to find the host name.
To set the ORACLE_HOSTNAME environment variable:
Display System in the Windows Control Panel.
In the System Properties dialog box, click Advanced.
In the Advanced tab, click Environment Variables.
In the Environment Variables dialog box, under System Variables, click New.
In the New System Variable dialog box, enter the following information:
Variable name: ORACLE_HOSTNAME
Variable value: The host name of the computer to use.
Click OK, then in the Environment Variables dialog box, click OK.
Click OK in the Environment Variables dialog box, then in the System Properties dialog box, click OK.
Ref: https://docs.oracle.com/cd/E11882_01/install.112/e47798/reqs.htm#NTDBI2710

Connecting to Oracle database installed on one pc to the java application from another machine

I've installed Oracle 12c (desktop class) on my machine, and I can use it via sql developer on the same machine. Now how can I use the same database from another machine (for java application) in the LAN? I tried using the jdbc thin driver as follows: jdbc:oracle:thin:#10.0.11.69:1521:orcl where 10.0.11.69 is my ip address where Oracle is installed. Do i need to install any server where oracle is installed(10.0.11.69) to connect to my db from another machine?
I'm trying this from past 3 days and referred to many questions of the same model but none solved my issue.
My tnsnames.ora description is as follows:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Thanks in advance.
You need to connect to PDB if it is a Oracle 12c installation. You can add the following entry in tnsnames.ora:
pdborcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=TCP)(HOST=localhost)(PORT=1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
After setting this, the listener needs to be restarted.
lsnrctl stop
lsnrctl start
Then the connect string will be something like this:
jdbc:oracle:thin:#//10.0.11.69:1521/pdborcl
Note the connect string above uses service name instead of SID, because in 12C we need to use service name instead of SID to connect to PDB. Check this post for more details.
Java application will not use tnsnames.ora by it's own. You have to call:
System.setProperty("oracle.net.tns_admin", "..path to tnsnames.ora");
To tell the driver where to search for it.
Also note, that some tnsnames.ora constructs are not supported by thin driver. For examples the "include" directive.
Thanks for the following link, Configuring the connection between client and server Oracle 10g
after researching for a long time I found that I need to add my LAN address(10.0.11.69) in the listener.ora file which solves my problem.
so my listener.ora will looks like this now:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST=
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.11.69)(PORT = 1521))
)
)
)

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor. Eclipse and Fedora 20 via JDBC

I've installed Oracle 11g XE on a Fedora 20 Virtual Machine, configured it and set the enviroment variables (running the oracle_env.sh). I've got this error when trying to connect Eclipse with the database via jdbc, using this string "jdbc.databaseurl=jdbc:oracle:thin:#192.168.88.134:1521:XE"
I can connect to the database in the Virtual Machine via SQL*Plus (sqlplus / as sysdba).
The $ORACLE_SID variable is ok (XE). I've already tried to stop and start the listener, then startup the database, and use the alter system register; command.
Also statically registering the database without success (I cannot asure I did not mistake doing this, so if somebody thinks this could solve my problem I would try again).
Here is the listener.ora file:
# listener.ora Network Configuration File:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.88.134)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
And the tnsnames.ora file:
# tnsnames.ora Network Configuration File:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.88.134)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
And lsnrctl status:
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 31-MAR-2014 01:22:35
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 30-MAR-2014 22:41:35
Uptime 0 days 2 hr. 41 min. 1 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/192/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.88.134)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
I'm almost sure that the problem is that the listener doesn't know about the database. The previous command should show, apart from what it already shows, something like
Service XE has 1 instance.
Instance "XE", status READY, has 1 handler for this service
... but it doesn't, and I don't know how to solve this.
I'm new at this, mainly at Linux, so I will appreciate every detail in the solutions you suggest.
This sounds like your database is trying to register using the wrong IP address to contact the listener. Your listener is configured to listen on 192.168.88.134, but perhaps the DB is assuming localhost (127.0.0.1), or an old IP value if the configuration has ever changed.
By default the database will attempt to register against the server's external host name (the default when local_listener is blank), but you may be getting an unexpected value from that - so what is in /etc/hosts for the machine name matters. Whatever has caused that, registration seems to be failing.
You can explicitly tell the DB to register using the actual listener address:
alter system set local_listener = '192.168.88.134:1521' scope=memory;
alter system register;
If that works and lsnrctl services now shows XE, then repeat the set command with scope=both to make it stick on the next DB restart.
Troubleshooting:
remove listener.ora (for this initial setup, you don't need it. make a backup of it)
lsnrctl reload
or
add XE to your SID_LIST like:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = XE)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe)
(PROGRAM = extproc)
)
)
lsnrctl reload
check the alert log for messages.
In your listener.ora:
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.88.134)(PORT = 1521))
Usually here by default there is a hostname instead of IP address. Did you do something special so that you have that IP there (192.168.88.134)?

ORA-12154 when connecting using tns alias

I installed Oracle 11.2 on a Win7x64 laptop and almost everything works fine. One thing I don't understand, however. I can connect to the sample HR schema with:
sqlplus hr/password
but not with:
sqlplus hr/password#orcl
I get an ORA-12154: TNS:could not resolve the connect identifier specified.
I found this out by accident, as I was expecting the second option to be correct. Why can I leave out the TNS alias? I'm an Oracle beginner but when I connect to other environments, the TNS alias is required or I can't make a connection.
I have the following in my tnsnames.ora:
LISTENER_ORCL = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA = (DESCRIPTION =
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)))
(CONNECT_DATA = (SID = CLRExtProc)(PRESENTATION = RO)))
ORCL, DUMMY = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = orcl)))
I know for sure it's being used because both tnsping orcl and tnsping dummy are ok. Can someone explain this to me?
UPDATE 1: The output of lsnrctl status is the following:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
Start Date 11-NOV-2012 00:43:22
Uptime 0 days 0 hr. 15 min. 53 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app\Ronald\product\11.2.0\dbhome_1\network\admin\listener.ora
Listener Log File c:\app\ronald\diag\tnslsnr\Ronald-PDC\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
The result of SELECT name FROM v$database is one database: ORCL.
UPDATE 2: Output of tnsping orcl (formatted for readability).
Used parameter files:
C:\app\Ronald\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (20 msec)
Did you actually create a database instance named ORCL?
Check out the actual name of your database with the command
lsnrctl status
This should tell you what services the listener knows about, which is what you're talking to when connecting with the # syntax. The reason you can connect without the #ORCL is that in that case you're using interprocess communication (IPC) and bypassing the listener, because the database is on the same computer as your SQL*Plus client session.
You can also find out the database name when you connect in the first example with this:
SELECT name FROM v$database;
EDIT:
Try the EZConnect syntax and see if that works:
sqlplus user/pw#localhost/ORCL
Keep in mind that TNSPING doesn't do anything besides contact the listener - it doesn't verify the database can be accessed.
One more thing: It looks like maybe TCP isn't a configured protocol for the listener? check your listener.ora file (in the same directory as your tnsnames.ora file). The entry for LISTENER should look something like this:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
My TNSPING output looks a bit different in one line near the start of output:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost)(PORT=1521)))

Resources