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.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
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
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!