RAC 11.2.0.3 管理OCR檔案

snowdba發表於2014-07-06
1,確認Clusterware版本

[grid@node1 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.3.0]

2,確認OCR引導檔案的資訊

[grid@node1 ~]$ cat /etc/oracle/ocr.loc
ocrconfig_loc=+ORCVOTE
local_only=FALSE

3,新增OCR檔案到磁碟組+ARCH
[grid@node1 ~]$ ocrconfig -add +ARCH
PROT-20: Insufficient permission to proceed. Require privileged user

需要root許可權才可以執行
[grid@node1 ~]$ su -
Password:
[root@node1 ~]#
[root@node1 ~]# ocrconfig -add +ARCH

生成了映象mirror OCR檔案
[root@node1 ~]# cat /etc/oracle/ocr.loc
#Device/file  getting replaced by device +ARCH
ocrconfig_loc=+ORCVOTE
ocrmirrorconfig_loc=+ARCH       
local_only=false[root@node1 ~]# 

再次新增OCR檔案到磁碟組+DATA
[root@node1 ~]# ocrconfig -add +DATA
[root@node1 ~]#
[root@node1 ~]# cat /etc/oracle/ocr.loc
#Device/file  getting replaced by device +DATA
ocrconfig_loc=+ORCVOTE
ocrmirrorconfig_loc=+ARCH
ocrconfig_loc3=+DATA
local_only=false[root@node1 ~]# 

4,檢查OCR檔案
[root@node1 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2872
         Available space (kbytes) :     259248
         ID                       :  735735915
         Device/File Name         :   +ORCVOTE
                                    Device/File integrity check succeeded
         Device/File Name         :      +ARCH
                                    Device/File integrity check succeeded
         Device/File Name         :      +DATA
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

5,刪除OCR檔案
[root@node1 ~]# ocrconfig -delete +DATA
[root@node1 ~]#
[root@node1 ~]# cat /etc/oracle/ocr.loc
#Device/file +DATA being deleted
ocrconfig_loc=+ORCVOTE
ocrmirrorconfig_loc=+ARCH
local_only=false[root@node1 ~]#
[root@node1 ~]#
[root@node1 ~]# ocrconfig -delete +ARCH
[root@node1 ~]#
[root@node1 ~]# cat /etc/oracle/ocr.loc
#Device/file +ARCH being deleted
ocrconfig_loc=+ORCVOTE
local_only=false

6,驗證OCR完整性
[root@node1 ~]# cluvfy comp ocr -n all -verbose
You must NOT be logged in as root (uid=0) when running /g01/grid/app/11.2.0/grid/bin/cluvfy.

root使用者不被允許,切換到grid使用者
[root@node1 ~]# su - grid
[grid@node1 ~]$ cluvfy comp ocr -n all -verbose

Verifying OCR integrity

Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations


ASM Running check passed. ASM is running on all specified nodes

Checking OCR config file "/etc/oracle/ocr.loc"...

OCR config file "/etc/oracle/ocr.loc" check successful


Disk group for ocr location "+ORCVOTE" available on all the nodes


NOTE:
This check does not verify the integrity of the OCR contents. Execute 'ocrcheck' as a privileged user to verify the contents of OCR.

OCR integrity check passed

Verification of OCR integrity was successful. 

7,匯入和匯出OCR檔案
1,在所有節點關閉cluster,在節點node1,node2分別執行
[root@node1 ~]# crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node1'
CRS-2673: Attempting to stop 'ora.crsd' on 'node1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'node1'
CRS-2673: Attempting to stop 'ora.oc4j' on 'node1'
CRS-2673: Attempting to stop 'ora.ORCVOTE.dg' on 'node1'
CRS-2673: Attempting to stop 'ora.prod.db' on 'node1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'node1'
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'node1'
CRS-2677: Stop of 'ora.scan1.vip' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.scan1.vip' on 'node2'
CRS-2676: Start of 'ora.scan1.vip' on 'node2' succeeded
CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on 'node2'
CRS-2677: Stop of 'ora.prod.db' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.ARCH.dg' on 'node1'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'node1'
CRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'node2' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'node1' succeeded
CRS-2677: Stop of 'ora.ARCH.dg' on 'node1' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'node1' succeeded
CRS-2672: Attempting to start 'ora.oc4j' on 'node2'
CRS-2676: Start of 'ora.oc4j' on 'node2' succeeded
CRS-2677: Stop of 'ora.ORCVOTE.dg' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'node1'
CRS-2677: Stop of 'ora.asm' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'node1'
CRS-2677: Stop of 'ora.ons' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'node1'
CRS-2677: Stop of 'ora.net1.network' on 'node1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'node1' has completed
CRS-2677: Stop of 'ora.crsd' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'node1'
CRS-2673: Attempting to stop 'ora.evmd' on 'node1'
CRS-2673: Attempting to stop 'ora.asm' on 'node1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'node1'
CRS-2677: Stop of 'ora.evmd' on 'node1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'node1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'node1' succeeded
CRS-2677: Stop of 'ora.asm' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'node1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'node1'
CRS-2677: Stop of 'ora.cssd' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'node1'
CRS-2677: Stop of 'ora.crf' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'node1'
CRS-2677: Stop of 'ora.gipcd' on 'node1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'node1'
CRS-2677: Stop of 'ora.gpnpd' on 'node1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'node1' has completed
CRS-4133: Oracle High Availability Services has been stopped.

[root@node2 ~]# crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node2'
CRS-2673: Attempting to stop 'ora.crsd' on 'node2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'node2'
CRS-2673: Attempting to stop 'ora.node1.vip' on 'node2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'node2'
CRS-2673: Attempting to stop 'ora.cvu' on 'node2'
CRS-2673: Attempting to stop 'ora.ORCVOTE.dg' on 'node2'
CRS-2673: Attempting to stop 'ora.prod.db' on 'node2'
CRS-2673: Attempting to stop 'ora.oc4j' on 'node2'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'node2'
CRS-2677: Stop of 'ora.node1.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.cvu' on 'node2' succeeded
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'node2'
CRS-2677: Stop of 'ora.scan1.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.node2.vip' on 'node2'
CRS-2677: Stop of 'ora.node2.vip' on 'node2' succeeded
CRS-2677: Stop of 'ora.prod.db' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.ARCH.dg' on 'node2'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'node2'
CRS-2677: Stop of 'ora.ARCH.dg' on 'node2' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'node2' succeeded
CRS-2677: Stop of 'ora.oc4j' on 'node2' succeeded
CRS-2677: Stop of 'ora.ORCVOTE.dg' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'node2'
CRS-2677: Stop of 'ora.asm' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'node2'
CRS-2677: Stop of 'ora.ons' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'node2'
CRS-2677: Stop of 'ora.net1.network' on 'node2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'node2' has completed
CRS-2677: Stop of 'ora.crsd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'node2'
CRS-2673: Attempting to stop 'ora.evmd' on 'node2'
CRS-2673: Attempting to stop 'ora.asm' on 'node2'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'node2'
CRS-2677: Stop of 'ora.evmd' on 'node2' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'node2' succeeded
CRS-2677: Stop of 'ora.asm' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'node2'
CRS-2677: Stop of 'ora.ctssd' on 'node2' succeeded
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'node2'
CRS-2677: Stop of 'ora.cssd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'node2'
CRS-2677: Stop of 'ora.crf' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'node2'
CRS-2677: Stop of 'ora.gipcd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'node2'
CRS-2677: Stop of 'ora.gpnpd' on 'node2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'node2' has completed
CRS-4133: Oracle High Availability Services has been stopped.

[root@node2 ~]# ocrconfig -export /home/grid/ocr_export
[root@node2 ~]# ls -al /home/grid
total 164
drwx------ 5 grid oinstall  4096 Jul  2 05:51 .
drwxr-xr-x 4 root root      4096 Jun 11 01:52 ..
-rw------- 1 grid oinstall  5416 Jul  2 02:40 .bash_history
-rw-r--r-- 1 grid oinstall    33 Jun 11 01:52 .bash_logout
-rw-r--r-- 1 grid oinstall   348 Jun 11 23:50 .bash_profile
-rw-r--r-- 1 grid oinstall   124 Jun 11 01:52 .bashrc
-rw-r--r-- 1 grid oinstall   515 Jun 11 01:52 .emacs
drwxr-xr-x 4 grid oinstall  4096 Jun 11 01:52 .mozilla
-rw------- 1 root root     98621 Jul  2 05:51 ocr_export
drwxrwxr-x 3 grid oinstall  4096 Jun 11 10:49 oradiag_grid
drwxr-xr-x 2 grid oinstall  4096 Jun 11 10:30 .ssh
-rw-r--r-- 1 grid oinstall  3931 Jun 12 02:48 t.txt
-rw------- 1 grid oinstall  6845 Jul  1 23:54 .viminfo

2,匯入OCR檔案
在節點node2下以root使用者獨佔模式啟動cluster
[root@node2 ~]# crsctl start crs -excl -nocrs
CRS-4123: Oracle High Availability Services has been started.
CRS-2672: Attempting to start 'ora.mdnsd' on 'node2'
CRS-2676: Start of 'ora.mdnsd' on 'node2' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'node2'
CRS-2676: Start of 'ora.gpnpd' on 'node2' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'node2'
CRS-2672: Attempting to start 'ora.gipcd' on 'node2'
CRS-2676: Start of 'ora.cssdmonitor' on 'node2' succeeded
CRS-2676: Start of 'ora.gipcd' on 'node2' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'node2'
CRS-2672: Attempting to start 'ora.diskmon' on 'node2'
CRS-2676: Start of 'ora.diskmon' on 'node2' succeeded
CRS-2676: Start of 'ora.cssd' on 'node2' succeeded
CRS-2679: Attempting to clean 'ora.cluster_interconnect.haip' on 'node2'
CRS-2672: Attempting to start 'ora.ctssd' on 'node2'
CRS-2681: Clean of 'ora.cluster_interconnect.haip' on 'node2' succeeded
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'node2'
CRS-2676: Start of 'ora.ctssd' on 'node2' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'node2' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'node2'
CRS-2676: Start of 'ora.asm' on 'node2' succeeded

匯入OCR檔案
[root@node2 ~]# ocrconfig -import /home/grid/ocr_export

再次驗證OCR完整性
[root@node2 ~]# ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2840
         Available space (kbytes) :     259280
         ID                       :  684718087
         Device/File Name         :   +ORCVOTE
                                    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 succeeded

關閉節點node2的獨佔啟動模式
[root@node2 ~]# crsctl stop crs -f
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'node2'
CRS-2673: Attempting to stop 'ora.ctssd' on 'node2'
CRS-2673: Attempting to stop 'ora.asm' on 'node2'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'node2'
CRS-2677: Stop of 'ora.mdnsd' on 'node2' succeeded
CRS-2677: Stop of 'ora.asm' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'node2'
CRS-2677: Stop of 'ora.ctssd' on 'node2' succeeded
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'node2'
CRS-2677: Stop of 'ora.cssd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'node2'
CRS-2677: Stop of 'ora.gipcd' on 'node2' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'node2'
CRS-2677: Stop of 'ora.gpnpd' on 'node2' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'node2' has completed
CRS-4133: Oracle High Availability Services has been stopped.

重新啟動所有節點的clusterware,節點node1,node2分別執行
[root@node1 ~]# crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

[root@node2 ~]# crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

這個過程需要些時間,可以用crsctl status res -t來觀察其狀態
[root@node1 ~]# crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARCH.dg
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.DATA.dg
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.ORCVOTE.dg
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.asm
               ONLINE  ONLINE       node1                    Started            
               ONLINE  ONLINE       node2                    Started            
ora.gsd
               OFFLINE OFFLINE      node1                                       
               OFFLINE OFFLINE      node2                                       
ora.net1.network
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.ons
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       node2                                       
ora.cvu
      1        ONLINE  ONLINE       node2                                       
ora.node1.vip
      1        ONLINE  ONLINE       node1                                       
ora.node2.vip
      1        ONLINE  ONLINE       node2                                       
ora.oc4j
      1        ONLINE  ONLINE       node2                                       
ora.prod.db
      1        ONLINE  ONLINE       node1                    Open               
      2        ONLINE  ONLINE       node2                    Open               
ora.scan1.vip
      1        ONLINE  ONLINE       node2        

[root@node2 ~]# crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ARCH.dg
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.DATA.dg
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.ORCVOTE.dg
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.asm
               ONLINE  ONLINE       node1                    Started            
               ONLINE  ONLINE       node2                    Started            
ora.gsd
               OFFLINE OFFLINE      node1                                       
               OFFLINE OFFLINE      node2                                       
ora.net1.network
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
ora.ons
               ONLINE  ONLINE       node1                                       
               ONLINE  ONLINE       node2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       node2                                       
ora.cvu
      1        ONLINE  ONLINE       node2                                       
ora.node1.vip
      1        ONLINE  ONLINE       node1                                       
ora.node2.vip
      1        ONLINE  ONLINE       node2                                       
ora.oc4j
      1        ONLINE  ONLINE       node2                                       
ora.prod.db
      1        ONLINE  ONLINE       node1                    Open               
      2        ONLINE  ONLINE       node2                    Open               
ora.scan1.vip
      1        ONLINE  ONLINE       node2        


在節點node1再次執行cluvfy來檢查OCR的檔案完整性
[grid@node1 ~]$ cluvfy comp ocr -n all -verbose

Verifying OCR integrity

Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations


ASM Running check passed. ASM is running on all specified nodes

Checking OCR config file "/etc/oracle/ocr.loc"...

OCR config file "/etc/oracle/ocr.loc" check successful


Disk group for ocr location "+ORCVOTE" available on all the nodes


NOTE:
This check does not verify the integrity of the OCR contents. Execute 'ocrcheck' as a privileged user to verify the contents of OCR.

OCR integrity check passed

Verification of OCR integrity was successful.

8,OCRDUMP以ASCII方式列印OCR內容
[grid@node1 ~]$ ocrdump /home/grid/ocr_dump.log -xml
[grid@node1 ~]$ more /home/grid/ocr_dump.log


07/02/2014 06:13:59
/g01/grid/app/11.2.0/grid/bin/ocrdump.bin /home/grid/ocr_dump.log -xml


SYSTEM
UNDEF

PROCR_ALL_ACCESS
PROCR_READ
PROCR_READ
root
root


SYSTEM.version
UB4 (10)

PROCR_ALL_ACCESS
PROCR_READ
PROCR_READ
root
root


SYSTEM.version.activeversion
ORATEXT

PROCR_ALL_ACCESS
PROCR_READ
PROCR_READ 
root
root
……….
……….

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29047826/viewspace-1210608/,如需轉載,請註明出處,否則將追究法律責任。

相關文章