前些天,把linux的主机名改了,如从localhost改成rac面后发现客户端连接不到oracle,打开监听器配置如下
[root@rac admin]# cat listener.ora
# listener.ora Network Configuration File: /u01/oracle/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = /u01/oracle)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/oracle)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
注意此时肜的主机名是localhost,但实际改过后的主机名是rac,故此时客户端就连接不到oracle
修改如下:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac)(PORT = 1521))
)
)
注意要先停止监听器,而后再改监听器配置文件,而后再启动监听器,否则会报
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused
既不允许在监听器运行过程中,修改其监听器配置文件