給ocr增加ocrmirror時遇到的問題總結

warehouse發表於2010-03-19

原本以為會很順利,沒想到遇到了幾個問題,簡單總結一下...

[@more@]

[oracle@node1 bin]$ ./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 - Show backup information
-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.

[oracle@node1 bin]$ ./ocrconfig -replace ocrmirror /dev/raw/raw5
PROT-20: Insufficient permission to proceed. Require privileged user
--注意許可權的問題,需要用root
[oracle@node1 bin]$ su - root
Password:
[root@node1 ~]# cd /crs/bin
[root@node1 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw7
PROT-1: Failed to initialize ocrconfig
[root@node1 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw7
PROT-1: Failed to initialize ocrconfig
[root@node1 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw10
PROT-1: Failed to initialize ocrconfig
[root@node1 bin]# fdisk -l /dev/sde

Disk /dev/sde: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sde1 1 13 104391 83 Linux
/dev/sde2 14 26 104422+ 83 Linux
/dev/sde3 27 261 1887637+ 5 Extended
/dev/sde5 27 43 136521 83 Linux
/dev/sde6 44 60 136521 83 Linux
/dev/sde7 61 73 104391 83 Linux
/dev/sde8 74 86 104391 83 Linux
/dev/sde9 87 99 104391 83 Linux
/dev/sde10 100 112 104391 83 Linux
[root@node1 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw5
PROT-1: Failed to initialize ocrconfig
--crs沒有啟動時執行./ocrconfig -replace ocrmirror會收到如下提示
[root@node1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 104336
Used space (kbytes) : 4580
Available space (kbytes) : 99756
ID : 1892429764
Device/File Name : /dev/raw/raw2
Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

[root@node1 bin]# raw -qa
/dev/raw/raw1: bound to major 8, minor 65
/dev/raw/raw2: bound to major 8, minor 66
/dev/raw/raw3: bound to major 8, minor 67
/dev/raw/raw5: bound to major 8, minor 69
/dev/raw/raw6: bound to major 8, minor 70
/dev/raw/raw7: bound to major 8, minor 71
/dev/raw/raw8: bound to major 8, minor 72
/dev/raw/raw9: bound to major 8, minor 73
/dev/raw/raw10: bound to major 8, minor 74
[root@node1 bin]# rdate -s node2
[root@node1 bin]#

--=============================
[root@node1 oracle]# more ocr.loc
ocrconfig_loc=/dev/raw/raw2
local_only=FALSE

[root@node1 bin]# ./crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly
[root@node1 bin]# ./ocrconfig -replace ocrmirror /dev/raw/raw5
[root@node1 bin]# ./ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 104336
Used space (kbytes) : 4580
Available space (kbytes) : 99756
ID : 1892429764
Device/File Name : /dev/raw/raw2
Device/File integrity check succeeded
Device/File Name : /dev/raw/raw5
Device/File integrity check succeeded

Cluster registry integrity check succeeded

[root@node1 bin]# more /etc/oracle/ocr.loc
#Device/file getting replaced by device /dev/raw/raw5
ocrconfig_loc=/dev/raw/raw2
ocrmirrorconfig_loc=/dev/raw/raw5
local_only=false
[root@node1 bin]#
--修改成功之後我們主要到/etc/oracle/ocr.loc檔案也同步被做了修改
另外在執行命令./ocrconfig -replace ocrmirror...時還可能會收到如下錯誤提示:
PROT-22: Storage too small
這是由於一個bug造成的:
Oracle Cluster Registry (OCR)2009-05-23 13:11$ ocrconfig -replace ocrmirror /ora10g/app/oracle/oradata/V10/OracleClusterRegistry2
PROT-22: Storage too small
The problem is due to an Oracle bug where this operation requires the OCR mirror partition/file to be larger than the original by up to 128MB. The bug has been fixed in the 10.2.0.2 patchset.
1. get the voting disk location: cat /etc/oracle/ocr.loc ocrcheck
2. check or diagnose OCR integrity
cluvfy comp ocr -n all
ocrcheckocrdump3. Adding an Oracle Cluster Registry:
Note: RAC environments do not support more than two OCRs, a primary OCR and a second OCR. You must be root user to run ocrconfig commands.For PROT-16: Internal ErrorWhen issuing ocrconfig -replace it checks first about the size of the new OCR before making the replacement. If it is acceptable then it will replace to the new OCR.
The acceptable size is either 128Mb or 256Mb and so on. If the original OCR size was less than 128Mb, please make the new OCR as 128Mb or 256Mb. If the original OCR size was less than 256Mb and greater than 128Mb, please make the new OCR as 256Mb.
-- To implement the solution, please execute the following steps::
1). Please create another file ocrmirrornew.dbf:
dd if=/dev/zero of=/ocfs/OCR/ocrnew.dbf bs=1M count=128
dd if=/dev/zero of=/ocfs/OCR/ocrmirrornew.dbf bs=1M count=1282). Please run the following: ./ocrconfig -replace ocrmirror
./ocrconfig -replace ocr -ocfs example
./ocrconfig -replace ocrmirror /ocfs/OCR/ocrmirrornew.dbf
./ocrconfig -replace ocr /ocfs/OCR/ocrnew.dbf
-raw device example
./ocrconfig -replace ocrmirror /dev/raw/raw4
./ocrconfig -replace ocr /dev/raw/raw54. Removing the OCR:
ocrconfig -replace ocr -- remove an OCR device
ocrconfig -replace ocrmirror -- remove an OCR mirror device5. replace or move the location of an OCR device:Note: if your OCR resides on a cluster file system file or if the OCR is on an network file system, then create the target OCR file before continuing with this procedure.
ocrconfig -replace ocr -- provide the full path including file name
ocrconfig -replace ocrmirror 6. You may need to repair an OCR configuration on a particular node if your OCR configuration changes while that node is stopped. To repair an OCR configuration, run the following command on the node on which you have stopped the Oracle Clusterware daemon:ocrconfig –repair ocrmirror device_nameNote: You cannot perform this operation on a node on which the Oracle Clusterware daemon is running.7. show OCR backup:
ocrconfig -showbackupThe default location for generating backups on UNIX-based systems is CRS_home/cdata/cluster_name8. backup the OCR:
ocrconfig -export /u01/app/oracle/ocr.bak -s online9. restore the OCR:as oracle user:ocrconfig -showbackup
srvctl stop nodeapps -n linux1
srvctl stop nodeapps -n linux2
crs_stat -t
as root user:
crsctl stop crs (or init.crs stop)
ocrconfig import crsctl start crs (or init.crs start)cluvfy comp ocr -n all [-verbose]as oracle user:ocrconfig -showbackup
srvctl stop nodeapps -n linux1
srvctl stop nodeapps -n linux2
crs_stat -t
as root user:
crsctl stop crs (or init.crs stop)
./ocrconfig -restore /u01/app/oracle/product/crs/cdata/crs/backup01.ocrcrsctl start crs (or init.crs start)cluvfy comp ocr -n all [-verbose]Example moving OCR file from OCFS to raw devices (From Metalink)
The OCR disk must be owned by root, must be in the oinstall group, and must have permissions set to 640. Provide at least 100 MB disk space for the OCR.

In this example the OCR files are located in the ocfs2 file system:
/ocfs2/ocr1, /ocfs2/ocr2
Create raw device files of at least 100 MB. In this example the new OCR file will be on the following devices:
/dev/raw/raw1, /dev/raw/raw2
Once the raw devices are created, use the dd command to zero out the device and make sure no data is written to the raw devices:
dd if=/dev/zero of=/dev/raw/raw1
dd if=/dev/zero of=/dev/raw/raw2Now you are ready to move/replace the OCR file to the new storage location.
Move/Replace the OCR device ocrconfig -replace ocr /dev/raw/raw1Add /dev/raw/raw2 as OCR mirror device ocrconfig -replace ocrmirror /dev/raw/raw2
Example of adding an OCR device file(From metalink)
If you have upgraded your environment from a previous version, where you only had one OCR device file, you can use the following step to add an additional OCR file.

In this example a second OCR device file is added:
Add /dev/raw/raw2 as OCR mirror device ocrconfig -replace ocrmirror /dev/raw/raw2Syntax for 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 - Show backup information
-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 informationNote:
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.

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

相關文章