ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

文档解释

ORA-12505: TNS:listener does not currently know of SID given in connect descriptor

Cause: The listener received a request to establish a connection to a database or other service. The connect descriptor received by the listener specified a SID for an instance (usually a database instance) that either has not yet dynamically registered with the listener or has not been statically configured for the listener. This may be a temporary condition such as after the listener has started, but before the database instance has registered with the listener.

Action:
– Wait a moment and try to connect a second time.
– Check which instances are currently known by the listener by executing: lsnrctl services
– Check that the SID parameter in the connect descriptor specifies an instance known by the listener.
– Check for an event in the listener.log file.

ORA-12505: TNS: listener does not currently know of SID given in connect descriptor这是由于指定的服务名称/SID不正确导致的。官方解释,这个错误可能是由于客户端连接字符串中指定的 SID 不存在于服务器端的监听器配置文件中,而且它也有可能是在不兼容的驱动程序的情况下指定一个错误的端口号。

常见案例

1)服务器端没有正确配置SID导致:该错误是由于指定的SID不在tnsnames.ora文件中所致,或者该文件中有不正确的定义所致。

2)客户端没有正确配置TNSNAMES.ORA:客户端TNSNAMES.ORA文件中指定的服务名/SID不存在,或者指定的服务名/SID不正确。

3)客户端没有正确配置sqlplus.exe环境变量:在使用sqlplus运行sql语句时,与指定的tnsname相对应的环境变量没有被设置。

正常处理方法及步骤

1)检查服务器端TNSNAMES.ORA文件,确认文件内容正确。

2)检查客户端TNSNAMES.ORA文件,确认内容正确。

3)检查sqlplus.exe环境变量,确认设置正确。

4)重启服务器端进程,重新启动客户端进程。

你可能感兴趣的