ORACLE 11G RAC--集群应用层命令扫盲

应用层就是RAC数据库,工具有SRVCTL,ONSCTL,CRS_STAT.
1.CRS_STAT:用来查看CRS维护的所有资源的运行状态。
[oracle@rac1 bin]$ ./crs_stat
NAME=ora.CRS.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.FRA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.LISTENER_SCAN1.lsnr
TYPE=ora.scan_listener.type
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.RACDB_DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.eons
TYPE=ora.eons.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.gsd
TYPE=ora.gsd.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.net1.network
TYPE=ora.network.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.oc4j
TYPE=ora.oc4j.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.ons
TYPE=ora.ons.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.LISTENER_RAC1.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.gsd
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac2.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.LISTENER_RAC2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.gsd
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.racdb.db
TYPE=ora.database.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.scan1.vip
TYPE=ora.scan_vip.type
TARGET=ONLINE
STATE=ONLINE on rac2

[oracle@rac1 bin]$
查看指定资源的状态
[oracle@rac1 bin]$ ./crs_stat ora.racdb.db
NAME=ora.racdb.db
TYPE=ora.database.type
TARGET=ONLINE
STATE=ONLINE on rac1

[oracle@rac1 bin]$
查看详细信息
[oracle@rac1 bin]$ ./crs_stat -v ora.racdb.db
NAME=ora.racdb.db
TYPE=ora.database.type
RESTART_ATTEMPTS=2
RESTART_COUNT=0
GEN_USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
GEN_USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2
USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2
FAILURE_THRESHOLD=1
FAILURE_COUNT=0
TARGET=ONLINE
STATE=ONLINE on rac1

[oracle@rac1 bin]$
查看更详细的信息
[oracle@rac1 bin]$ ./crs_stat -p ora.racdb.db
NAME=ora.racdb.db
TYPE=ora.database.type
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AUTO_START=restore
CHECK_INTERVAL=1
DESCRIPTION=Oracle Database resource
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
GEN_USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2
HOSTING_MEMBERS=
PLACEMENT=restricted
RESTART_ATTEMPTS=2
SCRIPT_TIMEOUT=60
START_TIMEOUT=600
STOP_TIMEOUT=600
UPTIME_THRESHOLD=1h
USR_ORA_INST_NAME@SERVERNAME(rac1)=racdb1
USR_ORA_INST_NAME@SERVERNAME(rac2)=racdb2

[oracle@rac1 bin]$

查看每个资源的权限定义crs_stat -ls
2.onsctl,用来管理配置ONS[ORACLE NOTIFICATION SERVICE]
查看ONS配置内容
[root@rac1 ~]# cat /u01/app/11.2.0/11ggrid/opmn/conf/ons.config
localport=6100          # line added by Agent
allowgroup=true
usesharedinstall=true
remoteport=6200         # line added by Agent
nodes=rac1:6200,rac2:6200               # line added by Agent
[root@rac1 ~]#
localport代表本地监听端口,本地指127.0.0.1,用来和运行在本地的客户端通信。
remoteport代表远程监听端口,用来和远程的客户端进行通信。
查看两个端口的使用方式:
[root@rac1 ~]# netstat -ano|grep 6100
tcp        0      0 127.0.0.1:6100              0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 127.0.0.1:56632             127.0.0.1:6100              ESTABLISHED keepalive (4919.37/0/0)
tcp        0      0 127.0.0.1:56630             127.0.0.1:6100              ESTABLISHED keepalive (4918.31/0/0)
tcp        0      0 127.0.0.1:6100              127.0.0.1:56630             ESTABLISHED off (0.00/0/0)
tcp        0      0 127.0.0.1:6100              127.0.0.1:56632             ESTABLISHED off (0.00/0/0)
tcp        0      0 127.0.0.1:6100              127.0.0.1:47402             TIME_WAIT   timewait (8.25/0/0)
[root@rac1 ~]# netstat -ano|grep 6200
tcp        0      0 0.0.0.0:6200                0.0.0.0:*                   LISTEN      off (0.00/0/0)
tcp        0      0 192.168.44.101:43749        192.168.44.102:6200         ESTABLISHED off (0.00/0/0)
[root@rac1 ~]#
ONSCTL START|STOP|DEBUG|RECONFIG|DETAILED可用来启,停,调式,重新载入配置文件
查看ONS进程运行情况
[root@rac1 ~]# ps -aef|grep ons
grid      3617  3571  0 Aug07 ?        00:05:12 /usr/NX/bin/nxagent -D -options /home/grid/.nx/C-rac1-1007-BD81B97F009D9E23984F52209ED67ED9/options -name NX - grid@rac1:1007 - racB :1007
oracle    7390     1  0 Aug08 ?        00:02:36 /u01/app/oracle/product/11.2.0/dbhome_1/perl/bin/perl /u01/app/oracle/product/11.2.0/dbhome_1/bin/emwd.pl dbconsole /u01/app/oracle/product/11.2.0/dbhome_1/rac1_racdb/sysman/log/emdb.nohup
grid     23072     1  0 Aug15 ?        00:00:00 /u01/app/11.2.0/11ggrid/opmn/bin/ons -d
grid     23073 23072  0 Aug15 ?        00:00:00 /u01/app/11.2.0/11ggrid/opmn/bin/ons -d
grid     23151     1  0 Aug15 ?        00:00:55 /u01/app/11.2.0/11ggrid/jdk/jre//bin/java -Doracle.supercluster.cluster.server=eonsd -Djava.net.preferIPv4Stack=true -Djava.util.logging.config.file=/u01/app/11.2.0/11ggrid/srvm/admin/logging.properties -classpath /u01/app/11.2.0/11ggrid/jdk/jre//lib/rt.jar:/u01/app/11.2.0/11ggrid/jlib/srvm.jar:/u01/app/11.2.0/11ggrid/jlib/srvmhas.jar:/u01/app/11.2.0/11ggrid/jlib/supercluster.jar:/u01/app/11.2.0/11ggrid/jlib/supercluster-common.jar:/u01/app/11.2.0/11ggrid/ons/lib/ons.jar oracle.supercluster.impl.cluster.EONSServerImpl
oracle   23699  7390  0 Aug15 ?        00:01:36 /u01/app/oracle/product/11.2.0/dbhome_1/jdk/bin/java -server -Xmx192M -XX:MaxPermSize=200M -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -DORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 -Doracle.home=/u01/app/oracle/product/11.2.0/dbhome_1/oc4j -Doracle.oc4j.localhome=/u01/app/oracle/product/11.2.0/dbhome_1/rac1_racdb/sysman -DEMSTATE=/u01/app/oracle/product/11.2.0/dbhome_1/rac1_racdb -Doracle.j2ee.dont.use.memory.archive=true -Djava.protocol.handler.pkgs=HTTPClient -Doracle.security.jazn.config=/u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_rac1_racdb/config/jazn.xml -Djava.security.policy=/u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_rac1_racdb/config/java2.policy -Djavax.net.ssl.KeyStore=/u01/app/oracle/product/11.2.0/dbhome_1/sysman/config/OCMTrustedCerts.txt-Djava.security.properties=/u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/home/config/jazn.security.props -DEMDROOT=/u01/app/oracle/product/11.2.0/dbhome_1/rac1_racdb -Dsysman.md5password=true -Drepapi.oracle.home=/u01/app/oracle/product/11.2.0/dbhome_1 -Ddisable.checkForUpdate=true -Doracle.sysman.ccr.ocmSDK.websvc.keystore=/u01/app/oracle/product/11.2.0/dbhome_1/jlib/emocmclnt.ks -Dice.pilots.html4.ignoreNonGenericFonts=true -Djava.awt.headless=true -jar /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/home/oc4j.jar -config /u01/app/oracle/product/11.2.0/dbhome_1/oc4j/j2ee/OC4J_DBConsole_rac1_racdb/config/server.xml
root     26167 25635  0 22:08 pts/3    00:00:00 grep ons
oracle   29445 29401  0 Aug07 ?        00:16:42 /usr/NX/bin/nxagent -D -options /home/oracle/.nx/C-rac1-1008-2895CA7248F6302E5580BA7452F0165B/options -name NX - oracle@rac1:1008 - racB :1008

查看ONS服务状态
[root@rac1 bin]# ./onsctl ping
ons is running ...
[root@rac1 bin]#
查看DEBUG信息
[root@rac1 bin]# ./onsctl debug
HTTP/1.1 200 OK
Content-Length: 2425
Content-Type: text/html
Response:

== rac1:6200 23073 12/08/16 22:11:39 ==
Home: /u01/app/11.2.0/11ggrid

======== NS ========
           IP ADDRESS                   PORT    TIME   SEQUENCE  FLAGS
--------------------------------------- ----- -------- -------- --------
                         192.168.44.101  6200 502bbf1f 00000002 00000008

Listener:

  TYPE                BIND ADDRESS               PORT  SOCKET
-------- --------------------------------------- ----- ------
Local                                  127.0.0.1  6100      5
Remote                                       any  6200      7

Servers: (1)

            INSTANCE NAME                  TIME   SEQUENCE  FLAGS     DEFER
---------------------------------------- -------- -------- -------- ----------
dbInstance_rac2_6200                     5021073b 0000000c 00000002          0
                          192.168.44.102 6200

Connection Topology: (2)

                IP                      PORT   VERS  TIME
--------------------------------------- ----- ----- --------
                         192.168.44.102  6200     4 502bbf1f
                           **                          192.168.44.101 6200
                         192.168.44.101  6200     4 502bbf1f=
                           **                          192.168.44.102 6200

Server connections:

   ID            CONNECTION ADDRESS              PORT  FLAGS  SENDQ REF SUB WSA
-------- --------------------------------------- ----- ------ ----- --- --- ---
       0                          192.168.44.102  6200 010405 00000 001 000   

Client connections:

   ID            CONNECTION ADDRESS              PORT  FLAGS  SENDQ REF SUB WSA
-------- --------------------------------------- ----- ------ ----- --- --- ---
       1                                internal     0 01008a 00000 001 001   
       4                               127.0.0.1  6100 01001a 00000 001 001   
       5                               127.0.0.1  6100 01001a 00000 001 000   
 request                               127.0.0.1  6100 03201a 00000 001 000   

Worker Ticket: 4112/4112, Last: 12/08/16 22:11:35

   THREAD   FLAGS
  -------- --------
  b5f73b90 00000012
  b5f6bb90 00000012
  b5f63b90 00000012

Resources:

  Notifications:
    Received: Total 5 (Internal 2), in Receive Q: 0
    Processed: Total 5, in Process Q: 0

  Pools:
    Message: 49/50 (1), Link: 100/100 (1), Ack: 100/100 (1)
[root@rac1 bin]#
3.SRVCTL,这个命令功能比较强,可以操作DATABASE,INSTANCE,ASM,SERVICE,LISTENER,NODE APPLICATION.NODE APPLICATION又包含GSD,ONS,VIP.可以用SRVCTL统一管理这些资源。
用法说明:
[root@rac1 utl]# ./srvctl -help
Usage: srvctl []
    commands: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|instance|service|nodeapps|vip|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns
For detailed help on each command and object and its options use:
  srvctl -h or
  srvctl -h
[root@rac1 utl]#
查看数据库配置
[root@rac1 utl]# ./srvctl config database
racdb
[root@rac1 utl]#
-d选项查看某个数据库配置
[oracle@rac1 ~]$ cd /u01/app/11.2.0/11ggrid/crs/utl
[oracle@rac1 utl]$ ./srvctl config database -d racdb
Database unique name: racdb
Database name: racdb
Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +RACDB_DATA/racdb/spfileracdb.ora
Domain: **e.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: racdb
Database instances: racdb1,racdb2
Disk Groups: RACDB_DATA,FRA
Services:
Database is administrator managed
[oracle@rac1 utl]$
查看NODEAPPLICATION配置
[oracle@rac1 utl]$ ./srvctl config nodeapps -n rac1
-n option has been deprecated.
VIP exists.:rac1
VIP exists.: /rac1vip/192.168.44.201/255.255.255.0/eth0
GSD exists.
ONS daemon exists. Local port 6100, remote port 6200
eONS daemon exists. Multicast port 22440, multicast IP address 234.109.49.0, listening port 2016
[oracle@rac1 utl]$ ./srvctl config nodeapps -n rac2
-n option has been deprecated.
VIP exists.:rac2
VIP exists.: /rac2vip/192.168.44.202/255.255.255.0/eth0
GSD exists.
ONS daemon exists. Local port 6100, remote port 6200
eONS daemon exists. Multicast port 22440, multicast IP address 234.109.49.0, listening port 2016
[oracle@rac1 utl]$
-a查看VIP配置
[oracle@rac1 utl]$ ./srvctl config nodeapps -n rac1 -a
-n option has been deprecated.
VIP exists.:rac1
VIP exists.: /rac1vip/192.168.44.201/255.255.255.0/eth0
[oracle@rac1 utl]$
-g查看GSD配置
[oracle@rac1 utl]$ ./srvctl config nodeapps -n rac1 -g
-n option has been deprecated.
GSD exists.
[oracle@rac1 utl]$
-s查看ONS
[oracle@rac1 utl]$ ./srvctl config nodeapps -n rac1 -s
-n option has been deprecated.
ONS daemon exists. Local port 6100, remote port 6200
[oracle@rac1 utl]$
-l查看LISTENER
[oracle@rac1 utl]$ ./srvctl config nodeapps -n rac1 -l
-n option has been deprecated.
-l option has been deprecated and will be ignored.
VIP exists.:rac1
VIP exists.: /rac1vip/192.168.44.201/255.255.255.0/eth0
GSD exists.
ONS daemon exists. Local port 6100, remote port 6200
eONS daemon exists. Multicast port 22440, multicast IP address 234.109.49.0, listening port 2016
-n option has been deprecated and will be ignored.
Name: LISTENER
Network: 1, Owner: grid
Home:
End points: TCP:1521
[oracle@rac1 utl]$
查看ASM
[oracle@rac1 utl]$ ./srvctl config asm -n rac1
-n option has been deprecated and will be ignored.
ASM home: /u01/app/11.2.0/11ggrid
ASM listener: LISTENER
[oracle@rac1 utl]$ ./srvctl config asm -n rac2
-n option has been deprecated and will be ignored.
ASM home: /u01/app/11.2.0/11ggrid
ASM listener: LISTENER
[oracle@rac1 utl]$

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15720542/viewspace-741130/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15720542/viewspace-741130/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值