usage: ./onsctl start|stop|ping|reconfig|debug
start - Start opmn only.
stop - Stop ons daemon
ping - Test to see if ons daemon is running
debug - Display debug information for the ons daemon
reconfig - Reload the ons configuration
help - Print a short syntax description (this).
detailed - Print a verbose syntax description.
ONS 进程运行,并不一定代表ONS 正常工作,需要使用ping命令来确认。
1) 在OS级别查看进程状态。
[root@raw1 bin]# ps -aef|grep ons
root 1924 6953 0 03:17 pts/1 00:00:00 grep ons
oracle 30723 1 0 Mar08 00:00:00 /u01/app/oracle/product/crs/opmn/bin/ons -d
oracle 30724 30723 0 Mar08 00:00:04 /u01/app/oracle/product/crs/opmn/bin/ons -d
2) 确认ONS服务的状态
[root@raw1 bin]# ./onsctl ping
Number of onsconfiguration retrieved, numcfg = 2
onscfg[0]
{node = raw1, port = 6200}
Adding remote host raw1:6200
onscfg[1]
{node = raw2, port = 6200}
Adding remote host raw2:6200
ons is running ...
3) 启动ONS服务
[root@raw1 bin]# ./onsctl start
4) 使用debug 选项,可以查看详细信息,其中最有意义的就是能显示所有连接。
[root@raw1 bin]# ./onsctl debug
Number of onsconfiguration retrieved, numcfg = 2
onscfg[0]
{node = raw1, port = 6200}
Adding remote host raw1:6200
onscfg[1]
{node = raw2, port = 6200}
Adding remote host raw2:6200
HTTP/1.1 200 OK
Content-Length: 1357
Content-Type: text/ html
Response:
Listeners:
NAME BIND ADDRESS PORT FLAGS SOCKET
------- --------------- ----- -------- ------
Local 127.000.000.001 6100 00000142 7
Remote 010.085.010.119 6200 00000101 8
Request No listener
Server connections:
ID IP PORT FLAGS SENDQ WORKER BUSY SUBS
---------- --------------- ----- -------- ---------- -------- ------ -----
1 010.085.010.121 6200 00104205 0 1 0
Client connections:
ID IP PORT FLAGS SENDQ WORKER BUSY SUBS
---------- --------------- ----- -------- ---------- -------- ------ -----
3 127.000.000.001 6100 0001001a 0 1 0
4 127.000.000.001 6100 0001001a 0 1 1
Pending connections:
ID IP PORT FLAGS SENDQ WORKER BUSY SUBS
---------- --------------- ----- -------- ---------- -------- ------ -----
0 127.000.000.001 6100 00020812 0 1 0
Worker Ticket: 3/3, Idle: 180
THREAD FLAGS
-------- --------
17faba0 00000012
67f6ba0 00000012
32d6ba0 00000012
Resources:
Notifications:
Received: 1, in Receive Q: 0, Processed: 1, in Process Q: 0
Pools:
Message: 24/25 (1), Link: 25/25 (1), Subscription: 24/25 (1)
[root@raw1 bin]#
4.3 srvctl
该命令是RAC维护中最常用的命令,也是最复杂的命令。 这个工具可以操作下面的几种资源:Database,Instance,ASM,Service,Listener 和Node Application,其中Node application又包括GSD,ONS,VIP。 这些资源除了使用srvctl工具统一管理外,某些资源还有自己独立的管理工具,比如ONS可以使用onsctl命令进行管理;Listener 可以通过lsnrctl 管理。
[root@raw1 bin]# ./srvctl --help
Usage: srvctl