ORA-12545:Oracle SID 突然停止工作
ORA-12545 : Oracle SID Suddenly Stopped working
我有一个莫名其妙的问题。我在 Linux 上安装了一个运行良好的 Oracle 11g。我能够使用基于 SID 的连接字符串从其他机器远程连接,例如
sqlplus myschema@192.168.184.102:1521:orcl
然后由于一些莫名其妙的原因它停止工作了。我不确定我或其他人松动了什么。
现在我只能使用 SERVICE_NAME 或基于 TNSNAME 的方法进行远程连接
sqlplus myschema@192.168.184.102:1521/orcl
sqlplus myschema@ORCL
两者都有效,而且这很好,但是我有依赖于我可以更改的 SID 连接模式的应用程序。有好心人能帮我弄清楚我错过了什么吗
以下是我的配置:
LISTENER.ORA:
[oracle@dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dbora112)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/u01/app/oracle
收听者状态:
[oracle@dbora112 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-MAR-2015 14:50:05
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 04-MAR-2015 14:37:12
Uptime 0 days 0 hr. 12 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /opt/u01/app/oracle/diag/tnslsnr/dbora112/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbora112)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
TNSNAMES.ORA:
[oracle@dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.184.102)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
)
)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.184.102)(PORT = 1521))
SQLNET:
[oracle@dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
# sqlnet.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
ADR_BASE = /opt/u01/app/oracle
可以使用 TNS 连接没有问题
[oracle@dbora112 ~]$ sqlplus schema/xxx@ORCL
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:54:10 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
可以使用服务名称毫无问题地连接
[oracle@dbora112 ~]$ sqlplus schema/xxx@192.168.184.102/ORCL
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:55:52 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
无法连接 SID
[oracle@dbora112 ~]$ sqlplus schema/xxx@192.168.184.102:orcl
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:56:38 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12545: Connect failed because target host or object does not exist
数据库实例 (SID)
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
orcl
这可能是因为 Oracle 无法将主机名解析为 IP。你能用 nslookup 解析你的主机名吗?即,
nslookup yourhostname
还要确保反向查找正常工作:
nslookup yourIpAddr
由于您可以使用您的 TNS 别名进行连接,并且使用连接描述中的 SID,因此 SID 可以正常工作。
但是您的 EasyConnect 字符串不正确。 From the SQL*Plus documentation:
The easy or abbreviated connection identifier has the syntax:
[//]host[:port][/service_name]
您不能将 SID 与 Easy Connect 一起使用,只能使用服务名称;所以你的连接使用:
sqlplus schema/xxx@192.168.184.102:orcl
甚至
sqlplus schema/xxx@192.168.184.102:1521:orcl
...永远都行不通。您 可以 使用旧样式的 JDBC URL 形式:
jdbc:oracle:thin:@192.168.184.102:1521:orcl
...但这与 SQL*Plus 连接不同,尽管看起来很相似。
如果您尝试检查该表单的 JDBC 连接是否有效,您无法使用 SQL*Plus 进行此操作,但您的 TNS 别名检查正在验证它是否已设置正如您所期望的那样——只要它使用相同的主机、端口和 SID。使用较新的 JDBC 语法可能会更好,但从这个问题来看,您似乎无法更改它。
我有一个莫名其妙的问题。我在 Linux 上安装了一个运行良好的 Oracle 11g。我能够使用基于 SID 的连接字符串从其他机器远程连接,例如
sqlplus myschema@192.168.184.102:1521:orcl
然后由于一些莫名其妙的原因它停止工作了。我不确定我或其他人松动了什么。
现在我只能使用 SERVICE_NAME 或基于 TNSNAME 的方法进行远程连接
sqlplus myschema@192.168.184.102:1521/orcl
sqlplus myschema@ORCL
两者都有效,而且这很好,但是我有依赖于我可以更改的 SID 连接模式的应用程序。有好心人能帮我弄清楚我错过了什么吗
以下是我的配置:
LISTENER.ORA:
[oracle@dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dbora112)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/u01/app/oracle
收听者状态:
[oracle@dbora112 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-MAR-2015 14:50:05
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 04-MAR-2015 14:37:12
Uptime 0 days 0 hr. 12 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /opt/u01/app/oracle/diag/tnslsnr/dbora112/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbora112)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
TNSNAMES.ORA:
[oracle@dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.184.102)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
)
)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.184.102)(PORT = 1521))
SQLNET:
[oracle@dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
# sqlnet.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
ADR_BASE = /opt/u01/app/oracle
可以使用 TNS 连接没有问题
[oracle@dbora112 ~]$ sqlplus schema/xxx@ORCL
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:54:10 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
可以使用服务名称毫无问题地连接
[oracle@dbora112 ~]$ sqlplus schema/xxx@192.168.184.102/ORCL
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:55:52 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
无法连接 SID
[oracle@dbora112 ~]$ sqlplus schema/xxx@192.168.184.102:orcl
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:56:38 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12545: Connect failed because target host or object does not exist
数据库实例 (SID)
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
orcl
这可能是因为 Oracle 无法将主机名解析为 IP。你能用 nslookup 解析你的主机名吗?即,
nslookup yourhostname
还要确保反向查找正常工作:
nslookup yourIpAddr
由于您可以使用您的 TNS 别名进行连接,并且使用连接描述中的 SID,因此 SID 可以正常工作。
但是您的 EasyConnect 字符串不正确。 From the SQL*Plus documentation:
The easy or abbreviated connection identifier has the syntax:
[//]host[:port][/service_name]
您不能将 SID 与 Easy Connect 一起使用,只能使用服务名称;所以你的连接使用:
sqlplus schema/xxx@192.168.184.102:orcl
甚至
sqlplus schema/xxx@192.168.184.102:1521:orcl
...永远都行不通。您 可以 使用旧样式的 JDBC URL 形式:
jdbc:oracle:thin:@192.168.184.102:1521:orcl
...但这与 SQL*Plus 连接不同,尽管看起来很相似。
如果您尝试检查该表单的 JDBC 连接是否有效,您无法使用 SQL*Plus 进行此操作,但您的 TNS 别名检查正在验证它是否已设置正如您所期望的那样——只要它使用相同的主机、端口和 SID。使用较新的 JDBC 语法可能会更好,但从这个问题来看,您似乎无法更改它。