Skip to content

Oracle恢复 - 12. page

Rac备份概念

提供给公司开发人员的Rac的备份概念:

1.ocr的备份
ocrconfig -help | grep port

-export [-s online] – Export cluster register contents to a file
-import
– Import cluster registry contents from a file
从这部分可以知道 ocr的备份方式是以类似exp/imp的方式进行导出操作(也可以使用dd一般首选oracle的备份方式)

这里测测试:

ORACLE@node1:/oracle/product/10.2.0/crs/log/node1/racg>ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 838552
Used space (kbytes) : 3812
Available space (kbytes) : 834740
ID : 1008840117
Device/File Name : /dev/raw/raw3
Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded

以上信息可以得到这里的OCR是放在/de/raw/raw3

备份方式:

ocrconfig -export /oracle/ocr_20110420.bak

[root@node1 oracle]# ocrconfig -showbackup

node1 2011/04/19 14:42:20 /oracle/product/10.2.0/crs/cdata/crs

node1 2011/04/19 10:42:20 /oracle/product/10.2.0/crs/cdata/crs

node1 2011/04/19 06:42:20 /oracle/product/10.2.0/crs/cdata/crs

node2 2011/04/18 14:06:02 /oracle/product/10.2.0/crs/cdata/crs

node2 2011/04/15 04:09:45 /oracle/product/10.2.0/crs/cdata/crs

恢复过程将会很简单,通过 ocrconfig -restore 就可以恢复这里的物理备份。
通过strings可以将其中的字符串取出来看一个印象:
strings /oracle/ocr_20110420.bak |sort -u

2.voting disk备份

voting的备份以dd的方式为主

[root@node1 oracle]# clear

[root@node1 oracle]# crsctl query css votedisk
0. 0 /dev/raw/raw2

located 1 votedisk(s).

通过 crsctl query css votedisk
查询到voting所在的raw

然后通过dd备份
[root@node1 oracle]# dd if=/dev/raw/raw2 of=/oracle/voting_20110420.bak
x417760+0 records in
417760+0 records out
213893120 bytes (214 MB) copied, 126.633 seconds, 1.7 MB/s
当需要恢复时,通过dd进行恢复即可。

3。Rac的数据备份

一:归档日志放在共享存储的情况
在这类情况备份只要执行以下的命令就可以成功全备

run{
allocate channel ch1 device type disk;
backup
#incremental level 1 comulative
database;
release channel ch1;

allocate channel ch1 device type disk;
backup archivelog all delete input;
release channel ch1;

allocate channel ch1 device type disk;
backup format ‘/oracle/ctl_%U_%T_%D’ current controlfile;
release channel ch1}

二:归档日志放在2个节点的情况

run{
allocate channel ch1 device type disk connect sys/oracle@ldrac1;
allocate channel ch2 device type disk connect sys/oracle@ldrac2;
backup
#incremental level 1 comulative
database;
release channel ch1;
release channel ch2;

allocate channel ch1 device type disk connect sys/oracle@ldrac1;
allocate channel ch2 device type disk connect sys/oracle@ldrac2;
backup archivelog all delete input;
release channel ch1;
release channel ch2;

allocate channel ch1 device type disk connect sys/oracle@ldrac1;
allocate channel ch2 device type disk connect sys/oracle@ldrac2;
backup format ‘/oracle/ctl_%U_%T_%D’ current controlfile;
release channel ch1;
release channel ch2;}

注意的地方:
集群的数据备份 根据 集群本身的环境而定
所以在确认一个集群环境的时候注意先查看这个集群的存储规划和存储选型