Home  >  Article  >  Database  >  How to solve Oracle's 12505 error

How to solve Oracle's 12505 error

WBOY
WBOYOriginal
2022-05-25 16:02:4315232browse

12505 error occurs because "service_name" and sid are inconsistent. Solution: 1. Use "select INSTANCE_NAME from v$instance" to obtain the current sid in the database; 2. Fill in the obtained sid into the connection string of the database program.

How to solve Oracle's 12505 error

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How to solve Oracle's 12505 error

It is clear that the 12505 prompt appears. The instance library corresponding to the sid cannot be found, that is, Oracle's "service_name" is inconsistent with the sid.

Solution steps

1. Execute this statement:

select INSTANCE_NAME from v$instance;

Get the sid of the instance library

How to solve Oracles 12505 error

2. Then use the sid to log in to the system

ORA-12505:

before There is no problem logging into the database using PL/SQL DEVELOPER and SQLPLUS, but when the application connects to Oracle through JDBC, it cannot successfully connect, and the ORA-12505 error listener does not currently know of SID given in connect descriptor... appears.

After searching, it was found that Oracle's service_name and sid_name are inconsistent, and PL/SQL DEVELOPER and SQLPLUS use service_name to connect, and the application connects according to sid_name, so PL/SQL DEVELOPER and SQLPLUS can be connected and applied. The program cannot connect.

Problem description:

The following error occurred when using jdbc to connect to the Oracle 10.2.0.1.0 database today:

Connection refused(DESCRIPTION=(TMP=)(VSNNUM=153093120)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))

But the database can be connected normally through plsql, or You can connect to the database through sqlplus

After debugging and searching for relevant information, the cause of the problem is found as follows:

When jdbc connects to the database, you need to use the sid_name of the database instead of the services_name of the database

When using plsql to connect to the database, you only need the services_name of the database, so modify the services_name in the connection string to sid_name

Recommended tutorial: "Oracle Video Tutorial"

The above is the detailed content of How to solve Oracle's 12505 error. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn