I'm trying to connect to oracle db on remote server through sql developer. I copied the connection details to tnsnames and I'm able to connect to the db.
However i have another db application which is same as sqldeveloper and when I try to make a connection, I keep getting this error. This application uses oracle jdbc thin client which requires hostname and SID.
I got the below error:
java.sql.SQLException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
While troubleshooting, I changed the tns option in sqldeveloper and I have selected basic option to find out what went wrong and I realized that I'm able to connect to it because of the correct service name and not able to connect to the db via SID name even through sqldeveloper.
I have used some db queries to find out SID name but still i keep getting the same error. Please help me troubleshoot.
Thanks for your time..
Oracle SID is the unique name that uniquely identifies your instance/database, whereas the Service name is the TNS alias that you give when you remotely connect to your database, and this Service name is recorded in tnsnames.
On the other hand, the SERVICE_NAME is used to register an instance with the listener. In most all cases, Oracle recommends that the value of the service_name be the same as the SID. However, a SERVICE_NAME can point to more than one instance, and the DBA can gen-in additional SID's into a SERVICE_NAME .
select instance_name from v$instance; will give you SID name. select name from v$database; will give DB NAME. select instance_name from v$instance; will give you SID name.
SERVICE_NAMES specifies one or more names by which clients can connect to the instance. The instance registers its service names with the listener. When a client requests a service, the listener determines which instances offer the requested service and routes the client to the appropriate instance.
ORA-12505 means your client passed a SID that the listener on the server end didn't recognize at all.
In 10G and above You can use EZ connect without configuring the server side like this:
sqlplus hr@liverpool:1521/DEMO
hr is the user name
liverpool is the server name
1521 is the port the listener for the DB is listening on
DEMO is the database SID
(OR)
If you still want to use tnsnames.ora, try running tnsping SID from your client.
On LINUX, You can also have ORACLE read a tnsnames.ora file from a local path - just set TNS_ADMIN to the directory where your tnsnames.ora file is.
Otherwise, you need to configure tnsnames.ora in $ORACLE_HOME/network/admin on the client
If you need to know the database SID, use this:
select sys_context('userenv','db_name') from dual;
See this URL:
Checking oracle sid and database name
I'm facing this problem too. Linux with oracle 11.2.0.1.
What I found was that the connection string must be:
sqlplus hr@liverpool:1521:DEMO
and not
sqlplus hr@liverpool:1521/DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With