oracle 本地ocr,Oracle RAC之OCR和Voting Disks(二)

管理OCR

1.配置文件

OCR 和 OLR 在每个节点上都有一个本地的配置文件,存放在目录/etc/oracle下

[root@breath01 ~]# cat /etc/oracle/ocr.loc

#Device/file +DATA getting replaced by device +OCR

ocrconfig_loc=+OCR ---OCR存放的位置,ASM磁盘组

[root@breath01 ~]# cat /etc/oracle/olr.loc

olrconfig_loc=/u01/app/11.2.0/grid/cdata/breath01.olr --OLR存放位置

crs_home=/u01/app/11.2.0/grid

[root@breath01 ~]# ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 3

Total space (kbytes) : 262120

Used space (kbytes) : 3396

Available space (kbytes) : 258724

ID : 2022076317

Device/File Name : +OCR

Device/File integrity check succeeded

Device/File not configured

Device/File not configured

Device/File not configured

Device/File not configured

添加OCR 位置:

[root@breath01 ~]# ocrconfig -add +OCR_NEW

[root@breath01 ~]# ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 3

Total space (kbytes) : 262120

Used space (kbytes) : 3396

Available space (kbytes) : 258724

ID : 2022076317

Device/File Name : +OCR

Device/File integrity check succeeded

Device/File Name : +OCR_NEW

Device/File integrity check succeeded

Device/File not configured

Device/File not configured

Device/File not configured

Cluster registry integrity check succeeded

Logical corruption check succeeded

删除OCR 位置:

[root@breath01 ~]# ocrconfig -delete +OCR_NEW

[root@breath01 ~]# ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 3

Total space (kbytes) : 262120

Used space (kbytes) : 3396

Available space (kbytes) : 258724

ID : 2022076317

Device/File Name : +OCR

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

3.替换OCR

当OCR位置>=两个时候:

[root@breath01 ~]# ocrconfig -replace current_OCR_location -replacement new_OCR_location

当OCR位置只有一个时候:

[root@breath01 ~]# ocrconfig -add new_OCR_location

[root@breath01 ~]# ocrconfig -delete current_OCR_locationhttps://www.cndba.cn/Breath/article/2327https://www.cndba.cn/Breath/article/2327

4.修复OCR

当节点OCR不同步,不是最新的时候,需要进行OCR修复(如节点二停机时段中,OCR配置发生改变,这时节点二的OCR没有同步)

[root@breath01 ~]# ocrconfig -repair -replace current_OCR_location -replacement target_OCR_locationhttps://www.cndba.cn/Breath/article/2327

https://www.cndba.cn/Breath/article/2327

https://www.cndba.cn/Breath/article/2327

https://www.cndba.cn/Breath/article/2327

自动备份:每四小时自动备份一次,且随时保留五份备份(三份最近备份,一份前一天最后的备份,一份前一周最后的备份)。无法去人为自定义备份频率和保留的备份文件数量(即自动备份只能每四小时一次,总共五份备份)。生成备份的默认位置是Grid_home/cdata/cluster_name。

手动备份:运行 ocrconfig -manualbackup 随时在任意节点上以ROOT用户身份执行OCR备份。如:在更改OCR配置前,可做个手动备份,以防万一

查看备份文件:

[root@breath01 ~]# ocrconfig -showbackup

breath01 2017/11/22 09:48:11 /u01/app/11.2.0/grid/cdata/breath/backup00.ocr

breath01 2017/11/17 15:57:05 /u01/app/11.2.0/grid/cdata/breath/backup01.ocr

breath01 2017/11/17 11:57:05 /u01/app/11.2.0/grid/cdata/breath/backup02.ocr

breath01 2017/11/22 09:48:11 /u01/app/11.2.0/grid/cdata/breath/day.ocr

breath01 2017/11/09 04:03:47 /u01/app/11.2.0/grid/cdata/breath/week.ocr

PROT-25: Manual backups for the Oracle Cluster Registry are not available

只显示自动备份的文件:

[root@breath01 ~]# ocrconfig -showbackup auto

只显示手动备份的文件:

[root@breath01 ~]# ocrconfig -showbackup manual

修改创建备份的位置:

[root@breath01 ~]# ocrconfig -backuploc

手动备份:

[root@breath01 ~]# ocrconfig -manualbackup

breath01 2017/11/22 11:34:45 /u01/app/11.2.0/grid/cdata/breath/backup_20171122_113445.ocr

[root@breath01 ~]# ocrconfig -showbackup manual

breath01 2017/11/22 11:34:45 /u01/app/11.2.0/grid/cdata/breath/backup_20171122_113445.ocr

6.恢复OCR

前提条件:

①停止集群索引节点CRS,然后启动任一节点CRS到 -excl -nocrs 独占模式

②必须存在且可用的与原始OCR位置同名的位置,如磁盘组+OCR,则恢复时也得恢复到+OCR当中

root用户下运行恢复命令(backup00.ocr一直是最新的自动备份—常用):

[root@breath01 ~]# ocrconfig -restore /u01/app/11.2.0/grid/cdata/breath/backup00.ocr

grid用户下验证集群所有节点OCR完整性:

[grid@breath01 ~]$ cluvfy comp ocr -n all -verbose

7.OCR的Export,Import

命令格式就是 ocrconfig -export 和 ocrconfig -import

Oracle给出建议是 手动备份 ocrconfig -manualbackup 来代替这种导出

理由—-引用官方解释:

Oracle recommends that you use either automatic or manual backups, and the ocrconfig -restore command instead of the ocrconfig -export and ocrconfig -import commands to restore OCR for the following reasons:

● A backup is a consistent snapshot of OCR, whereas an export is not.

● Backups are created when the system is online. You must shut down Oracle Clusterware on all nodes in the cluster to get a consistent snapshot using the ocrconfig -export command.

● You can inspect a backup using the OCRDUMP utility. You cannot inspect the contents of an export.

● You can list backups with the ocrconfig -showbackup command, whereas you must keep track of all generated exports.

https://www.cndba.cn/Breath/article/2327https://www.cndba.cn/Breath/article/2327

管理Voting Disk

1.备份

在11g中不需要备份voting disk,它会自动备份在OCR备份当中,且随OCR备份的恢复一起恢复

2.还原

如果需要,先恢复OCR。

比如常见情况,OCR和Voting disk 都存放在一个diskgroup中,一起损坏

还原命令:crsctl replace votedisk +asm_disk_group

版权声明:本文为博主原创文章,未经博主允许不得转载。

OCR VotingDisk

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值