【Oracle】OCR的备份和恢复之导出导入

2022-07-10 12:52:50 浏览数 (1)

大家好,又见面了,我是全栈君。

使用导出导入进行OCR的备份和恢复:

在对集群做调整前。如:增删节点等操作前,应该对OCR进行一次备份。能够使用export备份到指定文件。

实验环境:

OS:OEL5.6

RAC:10.2.0.1.0

(1)关闭全部节点的CRS

节点1:

[root@rac1 crsd]# crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

节点2:

[root@rac2 ~]# crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

(2)导出OCR的内容。

[root@rac1 crsd]# cd

[root@rac1 ~]# ocrconfig -export ocrexp.exp

(3)启动CRS

节点一:

[root@rac1 ~]# crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

节点二:

[root@rac2 ~]# crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

[root@rac2 ~]# crs_stat -t

Name Type Target State Host

————————————————————

ora….B1.inst application ONLINE ONLINE rac1

ora….B2.inst application ONLINE ONLINE rac2

ora.RACDB.db application ONLINE ONLINE rac1

ora….SM1.asm application ONLINE ONLINE rac1

ora….C1.lsnr application ONLINE ONLINE rac1

ora.rac1.gsd application ONLINE ONLINE rac1

ora.rac1.ons application ONLINE ONLINE rac1

ora.rac1.vip application ONLINE ONLINE rac1

ora….SM2.asm application ONLINE ONLINE rac2

ora….C2.lsnr application ONLINE ONLINE rac2

ora.rac2.gsd application ONLINE ONLINE rac2

ora.rac2.ons application ONLINE ONLINE rac2

ora.rac2.vip application ONLINE ONLINE rac2

(4)破坏OCR中的内容

[root@rac2 ~]# dd if=/dev/zero of=/dev/raw/raw1 bs=1024 count=102400

102400 0 records in

102400 0 records out

104857600 bytes (105 MB) copied, 41.7897 seconds, 2.5 MB/s

(5)检查集群状态。OCR一致性:

[root@rac2 ~]# crs_stat -t

CRS-0184: Cannot communicate with the CRS daemon.

[root@rac2 ~]# ocrcheck

PROT-601: Failed to initialize ocrcheck

集群已经挂掉,一致性无法检查。

(6)使用Clusterware安装包中的clufy工具检查一致性

[root@rac1 cluvfy]# ./runcluvfy.sh comp ocr -n all

Verifying OCR integrity

Unable to retrieve nodelist from Oracle clusterware.

Verification cannot proceed.

检查失败。

(7)使用import恢复ocr内容。

[root@rac1 ~]# ocrconfig -import ocrexp.exp

(8)再次检查OCR

[root@rac1 ~]# ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 2

Total space (kbytes) : 104344

Used space (kbytes) : 3820

Available space (kbytes) : 100524

ID : 1731255225

Device/File Name : /dev/raw/raw1

Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

(9)cluvfy工具检查

[root@rac1 cluvfy]# ./runcluvfy.sh comp ocr -n all

Verifying OCR integrity

Checking OCR integrity…

Checking the absence of a non-clustered configuration…

All nodes free of non-clustered, local-only configurations.

Uniqueness check for OCR device passed.

Checking the version of OCR…

OCR of correct Version “2” exists.

Checking data integrity of OCR…

Data integrity check for OCR passed.

OCR integrity check passed.

Verification of OCR integrity was successful.

检查也没问题。

(10)关闭CRS

OCR被破坏后CRS已经异常停止。但有些进程依旧存活。假设不先关闭下CRS。直接启动CRS会无法启动。

节点一:

[root@rac1 crsd]# crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

节点二:

[root@rac2 crsd]# crsctl stop crs

Stopping resources.

Successfully stopped CRS resources

Stopping CSSD.

Shutting down CSS daemon.

Shutdown request successfully issued.

(10)启动CRS

节点一:

[root@rac1 cluvfy]# crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

节点二:

[root@rac2 ~]# crsctl start crs

Attempting to start CRS stack

The CRS stack will be started shortly

[root@rac2 crsd]# crs_stat -t

Name Type Target State Host

————————————————————

ora….B1.inst application ONLINE ONLINE rac1

ora….B2.inst application ONLINE ONLINE rac2

ora.RACDB.db application ONLINE ONLINE rac2

ora….SM1.asm application ONLINE ONLINE rac1

ora….C1.lsnr application ONLINE ONLINE rac1

ora.rac1.gsd application ONLINE ONLINE rac1

ora.rac1.ons application ONLINE ONLINE rac1

ora.rac1.vip application ONLINE ONLINE rac1

ora….SM2.asm application ONLINE ONLINE rac2

ora….C2.lsnr application ONLINE ONLINE rac2

ora.rac2.gsd application ONLINE ONLINE rac2

ora.rac2.ons application ONLINE ONLINE rac2

ora.rac2.vip application ONLINE ONLINE rac2

[root@rac2 crsd]# crsctl check crs

CSS appears healthy

CRS appears healthy

EVM appears healthy

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/115551.html原文链接:https://javaforall.cn

0 人点赞