RAC中lsnrctl和srvctl的区别是什么,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
案例:(环境:hp小机,10G rac)今天早上一客户发现连接不上数据库,反馈。
处理过程:
登录服务器发现有一台服务器集群监听处于关闭状态,lsnrctl status发现监听处于卡死状态,无法进行正常的关闭,重启
查看监听日志报错TNS-12545,另一台服务器监听正常,所以不着急……稳住,慢慢看。
$crs_stat -t
Name Type Target State Host
————————————————————
ora…..XFF.cs application ONLINE ONLINE rac1
ora….db1.srv application ONLINE ONLINE rac2
ora.devdb.db application ONLINE ONLINE rac2
ora….b1.inst application ONLINE ONLINE rac1
ora….b2.inst application ONLINE ONLINE rac2
ora….SM1.asm application ONLINE ONLINE rac1
ora….C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora….SM2.asm application ONLINE ONLINE rac2
ora….C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
既然从集群里面看到监听关了,那就找到监听进程杀掉
$ ps -ef |grep tnslsnr
grid 3232 1 0 10:59 ? 00:00:00 /g01/11ggrid/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN1 -inherit
kill -15 3232
lsnrctl start启动监听,监听状态恢复正常,但集群中监听状态仍然是offline
原因:srvctl操作的监听是listener_rac1,而lsnrctl操作的默认监听时CRS不会online,或者说lsnrctl操作的监听反馈不到CRS?
srvctl config listener -n rac1
解决办法:
lsnrctl stop –关闭监听
srvctl start listener -n rac1 –开启监听服务(rac1为主机名)
不过后来自己在11g库上做测试,没有发现这个问题。
此时恢复正常,附上listener.ora
LISTENER_RAC1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1521)(IP = FIRST))
)
)
SID_LIST_LISTENER_RAC1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
建议:RAC重启监听的话建议还是用srvctl