文档解释
ORA-12521: TNS:listener does not currently know of instance requested 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 in addition to the service name an instance name 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 INSTANCE_NAME parameter in the connect descriptor specifies an instance name known by the listener.
– Check for an event in the listener.log file.
官方解释
常见案例
1. 数据库实例刚刚安装,但未注册到监听程序中。
2. 在指定节点上运行了多个实例,但是客户端只知道一个实例,并尝试连接另一个实例。
3. 连接字符串中实例名(SID)的拼写错误。
正常处理方法及步骤
1、检查数据库连接字符串,确认实例名(SID)是否正确,SID应与数据库实例相匹配;
2、确认TNSNAMES.ORA文件中此实例是否存在;
3、检查数据库实例是否正确注册到监听程序中,请使用以下命令来检查:
(1)lsnrctl status
(2)lsnrctl services
(3)select instance_name from v$instance;
(1)如果用户是Windows操作系统环境:
a. 启动Oracle实例
b. 再次启动监听程序
(2)如果用户是Linux/Unix操作系统环境:
a. 关闭Oracle实例
b. 再次启动监听程序
c. 启动Oracle实例
5、重新启动和初始化客户端;
6、重新尝试连接实例。