How to add, remove, replace or move an Oracle Cluster Repository (OCR) and/or Voting Disk in Oracle Clusterware

How to add, remove, replace or move an Oracle Cluster Repository (OCR) and/or Voting Disk in Oracle Clusterware

The goal of this article is to provide steps to add, remove, replace or move an OCR (Oracle Cluster Repository) and Voting Disk in Oracle RAC 10gR2, 11gR1 and 11gR2 environment.

Usually, simply CP or DD the files once the new storage has been presented to the hosts. In this case, it is slightly different because:

  1. The Oracle Clusterware has the OCR and voting disks open and is actively using them. (Both primary and mirrors)
  2. There is an API provided for this function (ocrconfig and crsctl), which is the appropriate interface than typical cp and/or dd commands.

It is highly recommended to take a backup of the voting disk, and OCR device before making any changes.

Note: While the OCR and voting disk files can be saved together, e.g. in OCFS (such as in a pre-11.2 Clusterware environment) or in the same ASM volume group (such as in a 11.2 Oracle Clusterware environment), OCR and voting Volume files are actually two separate files or entities, and if you plan to modify or move OCR and Voting Disk files, you must follow the steps provided for both file types.

ADD/REMOVE/REPLACE/MOVE OCR Device

NOTE: You must be logged in as the root user, as the root user owns the OCR files. The command "ocrconfig -replace" can only be issued when CRS is running, otherwise "PROT-1: Failed to initialize ocrconfig" will be displayed.

Please ensure CRS is running on ALL cluster nodes during this operation, otherwise, the change will not reflect in the CRS down node, CRS will have a problem to startup from this down node. “ocrconfig -repair” option will be required to fix the ocr.loc file on the CRS down node.

Make sure there is a recent copy of the OCR file before making any changes:

ocrconfig -showbackup        

Use the following command to generate an export of the online OCR file:

In 10.2:

# ocrconfig -export [OCR_export_filename] -s online        

In 11.1 and 11.2:

# ocrconfig -manualbackup
node1 2008/08/06 06:11:58 /tmp/bkp/[OCR_export_filename].ocr        

To recover this file, use::

# ocrconfig -import [OCR_export_filename]        

To see whether OCR is healthy, run an ocrcheck, which should return with like below.

# ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 497928
Used space (kbytes) : 312
Available space (kbytes) : 497616
ID : 576761409
Device/File Name : /dev/raw/OCR1
Device/File integrity check succeeded
Device/File Name : /dev/raw/ORC2
Device/File integrity check succeeded

Cluster registry integrity check succeeded
        

For 11.1+, "ocrcheck" should also show "Logical corruption check succeeded"

1. To add an OCRMIRROR device when only OCR device is defined

To add an OCR mirror device, you need to provide the full path, including file name.

10.2 and 11.1:

# ocrconfig -replace ocrmirror /dev/raw/OCR22
> ocrconfig -replace ocrmirror \\OCR_DISKS\OCR11  - for Windows        

11.2+: From 11.2 onwards, upto 4 ocrmirrors can be added

# ocrconfig -add +OCRVOTE2
# ocrconfig -add /cluster_fs/ocrdisk.dat        

2. To remove an OCR device

To remove an OCR device:

10.2 and 11.1:

# ocrconfig -replace ocr        

11.2+:

# ocrconfig -delete [filename]

# ocrconfig -delete +OCR11        

To remove an OCR mirror device:

10.2 and 11.1:

# ocrconfig -replace ocrmirror        

11.2+:

# ocrconfig -delete [ocrmirror filename]

# ocrconfig -delete +OCR22        

After removal, the old OCR/OCRMIRROR can be deleted if they are on cluster filesystem

3. To replace or move the location of an OCR device

An ocrmirror must be in place before replacing the OCR device. If an OCR device is replaced with another of a different size, a clusterware restart needs to happen for the changed to reflect.

10.2 and 11.1: To replace the OCR device with [filename], provide the full path including file name.

# ocrconfig -replace ocr [new_filename_NAME]
# ocrconfig -replace ocr /dev/raw/OCR11
$ ocrconfig -replace ocr \\OCR_DISKS\OCR11 - for Windows        

To replace the OCR mirror device with [filename], provide the full path including file name.

# ocrconfig -replace ocrmirror [filename]
# ocrconfig -replace ocrmirror /dev/raw/OCR22
# ocrconfig -replace ocrmirror \\OCR_DISKS\OCR22  - for Windows        

11.2+: The command is same for replace either OCR or OCRMIRRORs (at least 2 OCR exist for replace command to work):

# ocrconfig -replace [current filename] -replacement [new filename]
# ocrconfig -replace /cluster_file/ocr.dat -replacement +OCRVOTE
# ocrconfig -replace +CRS -replacement +OCRVOTE        

4. To restore an OCR when clusterware is down

When OCR is not accessible, the CRSD process won't start, and the clusterware stack will not start completely either. A restore of OCR device access and good OCR content is required.

To view the automatic OCR backup:

# ocrconfig -showbackup
# ocrconfig -restore [path/filename of OCR backup]        
No alt text provided for this image

ADD/DELETE/MOVE Voting Disk

For pre 11.2, to take a backup of voting disk:

$ dd if=voting_disk_name of=backup_file_name        

For Windows:

ocopy \\VOTING_DISKS\votedisk1 z:\backups\votedisk1.bak        

For 11.2+, it is no longer required to back up the voting disk because its data is automatically backed up in OCR as part of some configuration change. The voting disk files are backed up automatically by Oracle Clusterware if the contents of the files have changed in the below ways:

  • Configuration parameters, for example misscount, have been added or modified
  • After performing voting disk add or delete operations

The voting disk contents are restored from a backup automatically when a new voting disk is added or replaced.

For 10gR2 release

Use "crsctl stop crs" as root to shutdown the Oracle ClusterWare on all nodes before making modification to the voting disk.

Use “crsctl query css votedisk” to determine the current voting disk location.

1. To add a Voting Disk, provide the full path including file name:

# crsctl add css votedisk [VOTINGDISK_LOCATION] -force
# crsctl add css votedisk /dev/raw/voting1 -force
# crsctl add css votedisk /cluster_fs/votedisk.dat -force
> crsctl add css votedisk \\VOTING_DISKS\VOTEDSK2 -force   - for windows        

2. To delete a Voting Disk, provide the full path including file name:

# crsctl delete css votedisk [VOTEDISK_LOCATION] -force
# crsctl delete css votedisk /dev/raw/voting1 -force
# crsctl delete css votedisk /cluster_fs/votedisk.dat -force
> crsctl delete css votedisk \\VOTING_DISKS\VOTEDSK1 -force   - for windows        

3. To move a Voting Disk, provide the full path including file name, add a device first before deleting the old one:

# crsctl add css votedisk [NEW_LOCATION] -force
# crsctl delete css votedisk [OLD_LOCATION] -force

# crsctl add css votedisk /dev/raw/voting4 -force
# crsctl delete css votedisk /dev/raw/voting1 -force        

After modifying the voting disk, start the Oracle Clusterware stack on all nodes

# crsctl start crs        

Verify the voting disk location using ROOT user.

# crsctl query css votedisk        

For 11gR1 release

Starting with 11.1.0.6, the below commands can be performed online (CRS is up and running).

1. To add a Voting Disk, provide the full path including file name:

# crsctl add css votedisk [VOTEDISK_LOCATION]
# crsctl add css votedisk /dev/raw/voting1
# crsctl add css votedisk /cluster_fs/votedisk.dat
> crsctl add css votedisk \\VOTING_DISK\VOTEDSK2        - for windows        

2. To delete a Voting Disk, provide the full path including file name:

# crsctl delete css votedisk [VOTEDISK_LOCATION]
# crsctl delete css votedisk /dev/raw/voting1 -force
# crsctl delete css votedisk /cluster_fs/votedisk.dat
> crsctl delete css votedisk \\VOTING_DISK\VOTEDSK1     - for windows        

3. To move a Voting Disk, provide the full path including file name:

# crsctl add css votedisk [NEW_LOCATION]
# crsctl delete css votedisk [OLD_LOCATION]

# crsctl add css votedisk /dev/raw/voting4
# crsctl delete css votedisk /dev/raw/voting1        

Verify the voting disk location:

# crsctl query css votedisk        

For 11gR2 release and later

From 11.2, votedisk can be stored on either ASM diskgroup or cluster file systems. The following commands can only be executed when Grid Infrastructure is running. As grid user:

1. To add a Voting Disk a. When votedisk is on cluster file system:

$ crsctl add css votedisk [cluster_fs/filename]        

b. When votedisk is on ASM diskgroup, no add option available. The number of votedisk is determined by the diskgroup redundancy. If more copies of votedisks are desired, one can move votedisk to a diskgroup with higher redundancy. See step 4.

If a votedisk is removed from a normal or high redundancy diskgroup for abnormal reason, it can be added back using:

sql> alter diskgroup [vote diskgroup name] add disk '[/path/name]' force;        

2. To delete a Voting Disk a. When votedisk is on cluster file system:

$ crsctl delete css votedisk [cluster_fs/filename]        

or

$ crsctl delete css votedisk [vdiskGUID]      ### (vdiskGUID is the File Universal Id from 'crsctl query css votedisk')        

b. When votedisk is on ASM, no delete option available, one can only replace the existing votedisk group with another ASM diskgroup

3. To move a Voting Disk on cluster file system

$ crsctl add css votedisk [new_cluster_fs/filename]
$ crsctl delete css votedisk [old_cluster_fs/filename]        

or

$ crsctl delete css votedisk [vdiskGUID]        

4. To move voting disk on ASM from one diskgroup to another diskgroup due to redundancy change or disk location change:

$ crsctl replace votedisk [+diskgroup>|<vdisk]< pre=""></vdisk]<>        

Example here is moving from external redundancy +OCRVOTE diskgroup to normal redundancy +CRS diskgroup:

1. create new diskgroup +CRS as desired:

$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   5e391d339a952fc7bf11f3276f9376f5 (ORCL:ASMDG02) [+OCRVOTE]
Located 1 voting disk(s).
$ crsctl replace votedisk +CRS
Successful addition of voting disk 941236c3d5d54fc0bfe182bd6ebbcbff.
Successful addition of voting disk 07d2464674ac4dhybf27f3132d8448b0.
Successful addition of voting disk 9761ccf221dr5f66bff0766ad5721239.
Successful deletion of voting disk 5e391d339a594fc7bd66f726f9375095.
Successfully replaced voting disk group with +CRS.
CRS-4266: Voting file(s) successfully replaced

$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   941236c3d5d54fc0bfe182bd6ebbcbff (ORCL:CRSD1) [CRS]
 2. ONLINE   07d2464674ac4dhybf27f3132d8448b0 (ORCL:CRSD2) [CRS]
 3. ONLINE   9761ccf221dr5f66bff0766ad5721239 (ORCL:CRSD3) [CRS]
Located 3 voting disk(s).        

2. To move voting disk between ASM diskgroup and cluster file system: a. Move from ASM diskgroup to cluster file system:

$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   6e5850d12c7a4f62bf6e693084460fd9 (ORCL:CRSD1) [CRS]
 2. ONLINE   56ab5c385ce34f37bf59580232ea815f (ORCL:CRSD2) [CRS]
 3. ONLINE   4f4446a59eeb4f75bfdfc4be2e3d5f90 (ORCL:CRSD3) [CRS]
Located 3 voting disk(s).
$ crsctl replace votedisk /rac_shared/oradata/vote.test3
Now formatting voting disk: /rac_shared/oradata/vote.test3.
CRS-4256: Updating the profile
Successful addition of voting disk 61c4347805b64fd5bf98bf32ca046d6c.
Successful deletion of voting disk 6e5850d12c7a4f62bf6e693084460fd9.
Successful deletion of voting disk 56ab5c385ce34f37bf59580232ea815f.
Successful deletion of voting disk 4f4446a59eeb4f75bfdfc4be2e3d5f90.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   61c4347805b64fd5bf98bf32ca046d6c (/rac_shared/oradata/vote.disk) []
Located 1 voting disk(s).        

b. Move from cluster file system to ASM diskgroup

$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   61c4347805b64fd5bf98bf32ca046d6c (/rac_shared/oradata/vote.disk) []
Located 1 voting disk(s).
$ crsctl replace votedisk +CRS
CRS-4256: Updating the profile
Successful addition of voting disk 41806377ff804fc1bf1d3f0ec9751ceb.
Successful addition of voting disk 94896394e50d4f8abf753752baaa5d27.
Successful addition of voting disk 8e933621e2264f06bfbb2d23559ba635.
Successful deletion of voting disk 61c4347805b64fd5bf98bf32ca046d6c.
Successfully replaced voting disk group with +CRS.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   41806377ff804fc1bf1d3f0ec9751ceb (ORCL:CRSD1) [CRS]
 2. ONLINE   94896394e50d4f8abf753752baaa5d27 (ORCL:CRSD2) [CRS]
 3. ONLINE   8e933621e2264f06bfbb2d23559ba635 (ORCL:CRSD3) [CRS]
Located 3 voting disk(s).        

6. To verify:

$ crsctl query css votedisk        

要查看或添加评论,请登录

Raul Pessoa, MBA的更多文章

社区洞察

其他会员也浏览了