ORACLE 11G RAC--叢集應用層命令掃盲

oracle_db發表於2012-08-16
應用層就是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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章