Oracle 11g RAC的常用管理

阅读更多

在Oracle 11g RAC中,主要管理工具是srvctl和crsctl。

 

srvctl(Server Control)是一个命令行工具,可用于管理定义在Oracle Cluster Registry (OCR)上的资源。

这些资源包括节点应用(nodeapps),它构成Oracle Cluterware,而其包括the Oracle Notification Service (ONS), the Global Services Daemon (GSD), and the Virtual IP (VIP)。

其他的资源也可以被SRVCTL管理,如databases, instances, listeners, services, and applications。

通过SRVCTL,可以启动或停止nodeapps、databases、instances、listeners和services,删除或移去instances和services,增加services,管理配置信息。

 

 

crsctl(Cluster Ready Services Control )是一个命令行工具,可以用于管理Oracle Clusterware daemons(何谓daemon,又名守护进程、后台进程,名称以字母d结尾)。这些daemon包括Cluster Synchronization Services (CSS), Cluster-Ready Services (CRS), and Event Manager (EVM)。

通过CRSCTL,可以启动或停止Oracle Cluster,确定Oracle Clusterware的当前状态。

 

 

通过这两个工具,我们可以管理Oracle 11g RAC。

 

1、查看各资源状态(nodeapps节点应用程序,ASM实例,数据库实例等)

需要在grid 用户下执行这些命令。

crs_stat -t
这是兼容10g的一个工具。

/home/grid@serv1=>+ASM1$crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    serv1      
ora....ER.lsnr ora....er.type ONLINE    ONLINE    serv1      
ora....N1.lsnr ora....er.type ONLINE    ONLINE    serv2      
ora.WEBDG.dg   ora....up.type ONLINE    ONLINE    serv1      
ora.asm        ora.asm.type   ONLINE    ONLINE    serv1      
ora.elvdb.db   ora....se.type ONLINE    ONLINE    serv1      
ora.eons       ora.eons.type  ONLINE    ONLINE    serv1      
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE              
ora....network ora....rk.type ONLINE    ONLINE    serv1      
ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE              
ora.ons        ora.ons.type   ONLINE    ONLINE    serv1      
ora....ry.acfs ora....fs.type ONLINE    ONLINE    serv1      
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    serv2      
ora....SM1.asm application    ONLINE    ONLINE    serv1      
ora....V1.lsnr application    ONLINE    ONLINE    serv1      
ora.serv1.gsd  application    OFFLINE   OFFLINE              
ora.serv1.ons  application    ONLINE    ONLINE    serv1      
ora.serv1.vip  ora....t1.type ONLINE    ONLINE    serv1      
ora....SM2.asm application    ONLINE    ONLINE    serv2      
ora....V2.lsnr application    ONLINE    ONLINE    serv2      
ora.serv2.gsd  application    OFFLINE   OFFLINE              
ora.serv2.ons  application    ONLINE    ONLINE    serv2      
ora.serv2.vip  ora....t1.type ONLINE    ONLINE    serv2      
ora.servdb.db  application    ONLINE    ONLINE    serv1      
ora....b1.inst application    ONLINE    ONLINE    serv1      
ora....b2.inst application    ONLINE    ONLINE    serv2 

 



crsctl stat  resource -t
这是取代10g的crs_stat的工具。

/home/grid@serv1=>+ASM1$crsctl status resource -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       serv1                                       
               ONLINE  ONLINE       serv2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       serv1                                       
               ONLINE  ONLINE       serv2                                       
ora.WEBDG.dg
               ONLINE  ONLINE       serv1                                       
               ONLINE  ONLINE       serv2                                       
ora.asm
               ONLINE  ONLINE       serv1                    Started            
               ONLINE  ONLINE       serv2                                       
ora.eons
               ONLINE  ONLINE       serv1                                       
               ONLINE  ONLINE       serv2                                       
ora.gsd
               OFFLINE OFFLINE      serv1                                       
               OFFLINE OFFLINE      serv2                                       
ora.net1.network
               ONLINE  ONLINE       serv1                                       
               ONLINE  ONLINE       serv2                                       
ora.ons
               ONLINE  ONLINE       serv1                                       
               ONLINE  ONLINE       serv2                                       
ora.registry.acfs
               ONLINE  ONLINE       serv1                                       
               ONLINE  ONLINE       serv2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       serv2                                       
ora.elvdb.db
      1        ONLINE  ONLINE       serv1                    Open               
      2        ONLINE  ONLINE       serv2                    Open               
ora.oc4j
      1        OFFLINE OFFLINE                                                  
ora.scan1.vip
      1        ONLINE  ONLINE       serv2                                       
ora.serv1.vip
      1        ONLINE  ONLINE       serv1                                       
ora.serv2.vip
      1        ONLINE  ONLINE       serv2                                       
ora.servdb.db
      1        ONLINE  ONLINE       serv1                                       
ora.servdb.servdb1.inst
      1        ONLINE  ONLINE       serv1                                       
ora.servdb.servdb2.inst
      1        ONLINE  ONLINE       serv2                                       
/home/grid@serv1=>+ASM1$

 


在11g R2中,默认 oc4j和gsd资源是 disable 的;oc4j  是用于WLM 的一个
资源, WLM在 11.2.0.2 才可用;gsd 是 CRS 用于跟 9i RAC 进行通信的一
个模块,是为了向后兼容才保留的,不影响性能;建议不要刪除, 也不要尝试开
启他们,  忽略即可。 



2、检查cluster运行状态

需要在grid 用户下执行这些命令。

/home/grid@serv1=>+ASM1$crsctl check -h   
Usage:
  crsctl check crs
     Check status of OHAS and CRS stack

  crsctl check cluster [[-all]|[-n [...]]]
     Check status of CRS stack

  crsctl check ctss
    Check status of Cluster Time Synchronization Services

  crsctl check resource { [...]|-w } [-n ] [-k ] [-d ]
     Check status of resource(s)

  crsctl check css
     Check status of Cluster Synchronization Services

 



3、检查nodeapps状态

需要在grid 用户下执行这些命令。

/home/grid@serv1=>+ASM1$srvctl status nodeapps        
VIP serv1-vip is enabled
VIP serv1-vip is running on node: serv1
VIP serv2-vip is enabled
VIP serv2-vip is running on node: serv2
Network is enabled
Network is running on node: serv1
Network is running on node: serv2
GSD is disabled
GSD is not running on node: serv1
GSD is not running on node: serv2
ONS is enabled
ONS daemon is running on node: serv1
ONS daemon is running on node: serv2
eONS is enabled
eONS daemon is running on node: serv1
eONS daemon is running on node: serv2
/home/grid@serv1=>+ASM1$

 

4、检查db状态

需要在grid 用户下执行这些命令。

/home/grid@serv1=>+ASM1$srvctl status database -d elvdb
Instance elvdb1 is running on node serv1
Instance elvdb2 is running on node serv2

 

 

5、检查asm状态

需要在grid 用户下执行这些命令。

/home/grid@serv1=>+ASM1$srvctl status asm
ASM is running on serv1,serv2


6、启动和关闭cluster

需要在root用户下执行这些命令。

[root@serv1 bin]# ./crsctl stop cluster -n serv1

[root@serv1 bin]# ./crsctl stop cluster -all

[root@serv1 bin]# ./crsctl stop cluster -n serv1 -f 强制关闭

[root@serv1 bin]# ./crsctl start cluster -n serv1


禁止CRS系统重启而自动启动

[root@serv1 bin]# ./crsctl disable crs
CRS-4621: Oracle High Availability Services autostart is disabled.

检查crs配置为是否自动启动

[root@serv1 bin]# ./crsctl  config crs
CRS-4621: Oracle High Availability Services autostart is disabled.


启用CRS系统重启而自动启动
[root@serv1 bin]# ./crsctl enable crs
CRS-4622: Oracle High Availability Services autostart is enabled.

[root@serv1 bin]# ./crsctl  config crs
CRS-4622: Oracle High Availability Services autostart is enabled.


7、ocr和votedisk检查

需要在grid用户下执行这些命令,crsctl  query css votedisk 和ocrcheck。

/home/grid@serv1=>+ASM1$crsctl  query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   7243adef0dbe4f3fbff361afb2c9d1a3 (/dev/raw/raw1) [DATA]
 
 
Located 1 voting disk(s).
 

 

/home/grid@serv1=>+ASM1$ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2964
         Available space (kbytes) :     259156
         ID                       :   43827983
         Device/File Name         :      +DATA
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user
 

 

你可能感兴趣的:(oracle,srvctl,crsctl)