以前看过Oracle10g RAC环境OCR的添加、删除、备份,里面ricky_zhu说过可以在线添加ocr和votedisk的,刚好今天试验环境需要添加ocr mirror , 就顺便作了个实验。
环境: aix 5.3+ oracle rac 11.1.0.7.0
root@test234 # ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262120
Used space (kbytes) : 3328
Available space (kbytes) : 258792
ID : 926476664
Device/File Name : /oracle/ocrfile1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
root@test233 # ls -rlt /oracle
total 565852
drwxr-xr-x 3 oracle oinstall 96 Jan 14 13:47 oradata
drwxrwxr-x 3 oracle oinstall 96 Jan 14 13:51 diag
drwxr-xr-x 2 oracle oinstall 96 Jan 15 16:19 lost+found
-rw------- 1 root system 102 Jan 16 16:32 nohup.out
-rw-r----- 1 root oinstall 268644352 Jan 16 16:46 ocrfile1
-rw-r----- 1 oracle oinstall 21070336 Jan 16 17:06 vdfile1
理论上来说,既然可以动态修改,那么命令行也会动态修改配置文件( solaris,linux为/var/opt/oracle/ocr.loc,aix为/etc/oracle/ocr.loc). 先看看里面的内容。
root@test234 # cat /etc/oracle/ocr.loc
ocrconfig_loc=/oracle/ocrfile1
local_only=FALSE
root@test233 # cat /etc/oracle/ocr.loc
ocrconfig_loc=/oracle/ocrfile1
local_only=FALSE
root@test233 # ocrconfig
Name:
ocrconfig - Configuration tool for Oracle Cluster Registry.
Synopsis:
ocrconfig [option]
option:
-export
[-s online]
- Export cluster register contents to a file
-import - Import cluster registry contents from a file
-upgrade [ []]
- Upgrade cluster registry from previous version
-downgrade [-version ]
- Downgrade cluster registry to the specified version
-backuploc - Configure periodic backup location
-showbackup [auto|manual] - Show backup information
-manualbackup - Perform OCR backup
-restore - Restore from physical backup
-replace ocr|ocrmirror [] - Add/replace/remove a OCR device/file
-overwrite - Overwrite OCR configuration on disk
-repair ocr|ocrmirror - Repair local OCR configuration
-help - Print out this help information
Note:
A log file will be created in
$ORACLE_HOME/log//client/ocrconfig_.log. Please ensure
you have file creation privileges in the above directory before
running this tool.
用ocrconfig -replace ocrmirror 添加,发现报错。
root@test233 # ocrconfig -replace ocrmirror /oracle/ocrfile2
PROT-21: Invalid parameter
问了下ricky_zhu,他说可能是文件名需要加” “,再试
root@test233 # ocrconfig -replace ocrmirror "/oracle/ocrfile2"
PROT-21: Invalid parameter
找了找 PROT-21: Invalid parameter是啥意思,
里面只提到mirror超过2个时会报这个错,难道我的超过了2个了?
root@test233 # ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262120
Used space (kbytes) : 3328
Available space (kbytes) : 258792
ID : 926476664
Device/File Name : /oracle/ocrfile1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
在2个机器上分别试都报这个错误。再想,会不会是需要先创建这个文件?
root@test233 # touch /oracle/ocrfile2
root@test233 # ocrconfig -replace ocrmirror /oracle/ocrfile2
成功!!
root@test233 # ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262120
Used space (kbytes) : 3328
Available space (kbytes) : 258792
ID : 926476664
Device/File Name : /oracle/ocrfile1
Device/File integrity check succeeded
Device/File Name : /oracle/ocrfile2
Device/File integrity check succeeded
Cluster registry integrity check succeeded
Logical corruption check succeeded
察看ocr.loc,发现该文件同时被修改。
root@test233 # cat /etc/oracle/ocr.loc
#Device/file getting replaced by device /oracle/ocrfile2
ocrconfig_loc=/oracle/ocrfile1
ocrmirrorconfig_loc=/oracle/ocrfile2
local_only=false
试着添加第二个mirror, 里说,mirror超过1个,ocr file 超过2个就会报”PROT-21: Invalid parameter “错误,试了试,发现不是那么回事。
Try to add the third mirror
# touch /oracle/ocrfile3
root@test233 # ocrconfig -replace ocrmirror /oracle/ocrfile3
root@test233 #
root@test233 # ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262120
Used space (kbytes) : 3328
Available space (kbytes) : 258792
ID : 926476664
Device/File Name : /oracle/ocrfile1
Device/File integrity check succeeded
Device/File Name : /oracle/ocrfile3
Device/File integrity check succeeded
Cluster registry integrity check succeeded
Logical corruption check succeeded
在线删除mirror
root@test233 # ocrconfig -replace ocrmirror
root@test233 # ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262120
Used space (kbytes) : 3328
Available space (kbytes) : 258792
ID : 926476664
Device/File Name : /oracle/ocrfile1
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
Logical corruption check succeeded
root@test233 # cat /etc/oracle/ocr.loc
#Device/file /oracle/ocrfile3 being deleted
ocrconfig_loc=/oracle/ocrfile1
local_only=false
root@test233 # rsh test234 cat /etc/oracle/ocr.loc
#Device/file /oracle/ocrfile3 being deleted
ocrconfig_loc=/oracle/ocrfile1
local_only=false
root@test233 # ocrconfig -replace ocrmirror /oracle/ocrfile2
root@test233 # cat /etc/oracle/ocr.loc
#Device/file getting replaced by device /oracle/ocrfile2
ocrconfig_loc=/oracle/ocrfile1
ocrmirrorconfig_loc=/oracle/ocrfile2
local_only=false
root@test233 # rsh test234 cat /etc/oracle/ocr.loc
#Device/file getting replaced by device /oracle/ocrfile2
ocrconfig_loc=/oracle/ocrfile1
ocrmirrorconfig_loc=/oracle/ocrfile2
local_only=false
配置文件同时被修改。
小结: 可以使用 ocrconfig -replace ocrmirror来添加,删除,替换ocrmirror, 添加时需要先手工生成该文件。该命令会同时自动修改配置文件。ocrmirror只能有一个。
Votedisk的添加和删除
root@racibm233 # crsctl check crs
Cluster Synchronization Services appears healthy
Cluster Ready Services appears healthy
Event Manager appears healthy
# crsctl query css votedisk
0. 0 /oracle/vdfile1
Located 1 voting disk(s).
root@racibm233 # ls -rlt /oracle
total 574408
drwxr-xr-x 3 oracle oinstall 96 Jan 14 13:47 oradata
drwxrwxr-x 3 oracle oinstall 96 Jan 14 13:51 diag
drwxr-xr-x 2 oracle oinstall 96 Jan 15 16:19 lost+found
-rw-r--r-- 1 root system 268644352 Jan 16 17:24 ocrfile3
-rw------- 1 root system 10812 Jan 16 22:36 nohup.out
-rw-r--r-- 1 root system 0 Jan 16 22:51 ocrfile2
-rw-r----- 1 root oinstall 268644352 Jan 16 22:52 ocrfile1
-rw-r----- 1 oracle oinstall 21070336 Jan 16 23:49 vdfile1
root@racibm233 # crsctl add css votedisk /oracle/vdfiles2
Now formatting voting disk: /oracle/vdfiles2.
Successful addition of voting disk /oracle/vdfiles2.
root@racibm233 # crsctl query css votedisk
0. 0 /oracle/vdfile1
1. 0 /oracle/vdfiles2
Located 2 voting disk(s).
root@racibm233 # crsctl check crs
Cluster Synchronization Services appears healthy
Cluster Ready Services appears healthy
Event Manager appears healthy
root@racibm233 # crsctl delete css votedisk /oracle/vdfiles2
Successful deletion of voting disk /oracle/vdfiles2.
root@racibm233 # ls -rlt /oracle
total 616344
drwxr-xr-x 3 oracle oinstall 96 Jan 14 13:47 oradata
drwxrwxr-x 3 oracle oinstall 96 Jan 14 13:51 diag
drwxr-xr-x 2 oracle oinstall 96 Jan 15 16:19 lost+found
-rw-r--r-- 1 root system 268644352 Jan 16 17:24 ocrfile3
-rw------- 1 root system 10812 Jan 16 22:36 nohup.out
-rw-r--r-- 1 root system 0 Jan 16 22:51 ocrfile2
-rw-r----- 1 root oinstall 268644352 Jan 16 23:51 ocrfile1
-rw-r----- 1 oracle oinstall 21070336 Jan 16 23:51 vdfiles2
-rw-r----- 1 oracle oinstall 21070336 Jan 16 23:51 vdfile1
root@racibm233 # crsctl query css votedisk
0. 0 /oracle/vdfile1
Located 1 voting disk(s).
root@racibm233 # rm -rf /oracle/vdfiles2
root@racibm233 # crsctl delete css votedisk /oracle/vdfile2
root@racibm233 # crsctl add css votedisk /oracle/vdfile2
Now formatting voting disk: /oracle/vdfile2.
Successful addition of voting disk /oracle/vdfile2.
root@racibm233 # crsctl query css votedisk
0. 0 /oracle/vdfile1
1. 0 /oracle/vdfile2
Located 2 voting disk(s).
root@racibm233 # crsctl add css votedisk /oracle/vdfile3
Now formatting voting disk: /oracle/vdfile3.
Successful addition of voting disk /oracle/vdfile3.
root@racibm233 # crsctl query css votedisk
0. 0 /oracle/vdfile1
1. 0 /oracle/vdfile2
2. 0 /oracle/vdfile3
Located 3 voting disk(s).
root@racibm233 # ls -rlt /oracle
total 661400
drwxr-xr-x 3 oracle oinstall 96 Jan 14 13:47 oradata
drwxrwxr-x 3 oracle oinstall 96 Jan 14 13:51 diag
drwxr-xr-x 2 oracle oinstall 96 Jan 15 16:19 lost+found
-rw-r--r-- 1 root system 268644352 Jan 16 17:24 ocrfile3
-rw------- 1 root system 10812 Jan 16 22:36 nohup.out
-rw-r--r-- 1 root system 0 Jan 16 22:51 ocrfile2
-rw-r----- 1 root oinstall 268644352 Jan 16 23:52 ocrfile1
-rw-r----- 1 oracle oinstall 21070336 Jan 16 23:53 vdfile3
-rw-r----- 1 oracle oinstall 21070336 Jan 16 23:53 vdfile2
-rw-r----- 1 oracle oinstall 21070336 Jan 16 23:53 vdfile1
小结: rac 11g的votedisk的添加更加方便,可以分别用crsctl add css votedisk *** 添加和 crsctl delete css votedisk ***(物理文件并没有被删除). 不像10g里需要crsctl add css votedisk *** -force, crsctl delete css votedisk *** -force .
参考文档:
阅读(776) | 评论(0) | 转发(0) |