[20170705]lsnrctl status LISTENER_SCAN1

简介: [20170705]lsnrctl status LISTENER_SCAN1.txt --//前几天在解决问题时遇到的问题,现在分析看看.当时没注意操作用户名,选择错误的用户执行(oracle用户执行).

[20170705]lsnrctl status LISTENER_SCAN1.txt

--//前几天在解决问题时遇到的问题,现在分析看看.当时没注意操作用户名,选择错误的用户执行(oracle用户执行).

1.环境:
--//rac
SYS@dbcn2> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

--//以oracle用户执行:
$ lsnrctl status LISTENER_SCAN1
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 05-JUL-2017 10:26:47
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
TNS-01101: Could not find service name LISTENER_SCAN1

--//实际上使用grid用户执行就ok了.使用strace做一次跟踪看看.

$ strace -f -o /tmp/a.txt lsnrctl status LISTENER_SCAN1

$ grep listener.ora /tmp/a.txt
90212 access("/etc/listener.ora", F_OK) = -1 ENOENT (No such file or directory)
90212 access("/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora", F_OK) = -1 ENOENT (No such file or directory)

--//可以发现这个文件不存在.不要在正式的数据库做这样的操作,这里仅仅是测试.
# cp /u01/app/11.2.0.4/grid/network/admin/listener.ora /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/

--//再次执行就ok了.
$ lsnrctl status LISTENER_SCAN1
--//删除文件/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora

2.疑问:
--//为什么在oracle下单独执行lsnrctl status 没有问题呢?
--//实际上oracle 缺省默认的建立名字就是LISTENER.

$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 05-JUL-2017 10:37:27
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                29-JUN-2017 19:23:54
Uptime                    5 days 15 hr. 13 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0.4/grid/network/admin/listener.ora
Listener Log File         /u01/app/11.2.0.4/grid/network/log/listener.log
....

--//让我感到奇怪的是,为什么现在能找到参数文件正确的参数文件/u01/app/11.2.0.4/grid/network/admin/listener.ora呢.

3.再次跟踪看看:
$ strace -f -o /tmp/a2.txt lsnrctl status

$ grep listener.ora /tmp/a2.txt
115234 access("/etc/listener.ora", F_OK) = -1 ENOENT (No such file or directory)
115234 access("/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora", F_OK) = -1 ENOENT (No such file or directory)
--//也是没有找到监听.

115234 access("/var/tmp/.oracle/s#48978.2", F_OK) = 0
115234 connect(6, {sa_family=AF_FILE, path="/var/tmp/.oracle/s#48978.2"...}, 110) = 0
115234 fcntl(6, F_SETFD, FD_CLOEXEC)    = 0

--//进程会读取/var/tmp/.oracle/s#48978.2.
# ls -l /var/tmp/.oracle/s#48978.2
srwxrwxrwx 1 grid oinstall 0 2017-06-29 19:23:54 /var/tmp/.oracle/s#48978.2
--//socket文件.里面的数值对于进程号.

# lsof | grep  /var/tmp/.oracle/s#48978.2
tnslsnr    48978   grid   10u     unix 0xffff881738bfe180       0t0 1991767425 /var/tmp/.oracle/s#48978.2

# ps -elf | egrep "48978|PID"
F S UID         PID   PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
0 S root       1936  87074  0  80   0 - 15299 pipe_w 10:50 pts/1    00:00:00 egrep 48978|PID
0 S grid      48978      1  0  80   0 - 38621 poll_s Jun29 ?        00:36:25 /u01/app/11.2.0.4/grid/bin/tnslsnr LISTENER -inherit

--//正是进程/u01/app/11.2.0.4/grid/bin/tnslsnr LISTENER -inherit.监听的别名是LISTENER.
# cat /proc/48978/environ | tr '\0' '\n'| grep -i admin
TNS_ADMIN=/u01/app/11.2.0.4/grid/network/admin/

--//所以oracle用户可以正常执行lsnrctl status .

4.补充说明:
--//实际上跟踪查看前面的/tmp/a.txt文件,只要对应的tnsnames.ora存在这个名字,一样ok了.

$ grep tnsnames.ora /tmp/a.txt
90212 access("/home/oracle/.tnsnames.ora", F_OK) = -1 ENOENT (No such file or directory)
90212 access("/etc/tnsnames.ora", F_OK) = -1 ENOENT (No such file or directory)
90212 access("/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/tnsnames.ora", F_OK) = 0
90212 stat("/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/tnsnames.ora", {st_mode=S_IFREG|0640, st_size=6403, ...}) = 0
90212 open("/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/tnsnames.ora", O_RDONLY) = 5
90212 read(5, "# tnsnames.ora Network Configura"..., 4096) = 4096

--//在/u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin目录的tnsnames.ora文件中加入如下:
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))

$ lsnrctl status LISTENER_SCAN1
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 05-JUL-2017 11:09:36
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                30-JUN-2017 12:01:44
Uptime                    4 days 23 hr. 7 min. 51 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0.4/grid/network/admin/listener.ora
Listener Log File         /u01/app/11.2.0.4/grid/network/log/listener_scan1.log
...

--//收尾:
--//仅仅作为一次学习与了解这方面内容,还原现场.
--//正常作为管理rac数据库系统还是应该选择grid用户来执行这些命令.

目录
相关文章
|
6月前
|
负载均衡 Java 应用服务中间件
Client not connected, current status:STARTING
Client not connected, current status:STARTING
559 1
|
6月前
|
SQL Oracle 关系型数据库
Oracle数据库启动时:ORA-00119: invalid specification for system parameter LOCAL_LISTENER;
Oracle数据库启动时:ORA-00119: invalid specification for system parameter LOCAL_LISTENER;
|
6月前
|
Oracle 关系型数据库 Java
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
1492 0
|
SQL Oracle 关系型数据库
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor案例2
今天使用SQL Developer连接一台测试服务器数据库(ORACLE 11g)时,遇到了“ORA-12514, TNS:listener does not currently know of service requested in connect descriptor”错误,具体提示如下所示:...
5399 0
|
数据库
ORA-12520: TNS:listener could not find available handler for requested type of server
当你碰到ORA-12520错误时,如下所示: 英文错误提示: ORA-12520: TNS:listener could not find available handler for requested type of server 中文错误提示: ORA-12520: TNS: 监听程序无法为请求的服务器类型找到可用的处理程序 一般你应该从下面两个方面去检查出错原因并解决问题:   1:数据库是专用服务器,但是在tnsname.ora配置文件中设置的连接方式是shared,这种情况需要修改tnsname.ora配置文件,这种错误情况一般发生在第一次连接数据库服务器。
1408 0
|
Oracle 关系型数据库 数据库
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection with the following error; ORA-12505,TNS:listener does
一次连接数据库怎么也连接不上,查了多方面资料,终于找到答案,总结 首先应该保证数据库的服务启动 在myeclipse的数据库视图中点 右键->new 弹出database driver的窗口, Driver template选择oracle(thin driver), Driver name 输入...
1132 0