最近忙于SAP的备份与恢复,源于客户的数据增长太快,远远超出先前规划:最早计划采用TSM+brtools 方式备份,这种备份基于file型备份,与操作系统层拷贝文件差不多,不管表空间里是否有数据,都要备份,那么带来问题就是速度慢,恢复复杂,特别是大型数据库,超过2TB级以上就更不用说了。
为了解决这个问题,我们建议使用brtools+rman备份方法:rman备份是基于block级的备份,他只对有数据的blocke备份;另外,rman可以采用多channel备份,这样可以同时开多个session进行备份(当然,这需要磁带库的drive数据量与sap的.sap配置相匹配)
一、准备工作
1.修改initSID.utl配置文件,修改rman_channel数
test:oracle >vi initSID.utl
rman_channel =2 #max channel for rman
2.与TSM Server认证
test:oracle > backint -p initSID.utl -f password
BKI2027I: Using TSM-API version 5.3.5.3 (compiled with 5.3.0.0).
BKI2000I: Successfully connected to ProLE on port tdpr3ora64.
BKI0005I: Start of program at: Wed Sep 3 15:38:20 BEIST 2008 .
BKI2017I: Blocksize is set to 131072 bytes
BKI0049I: Please enter password for node ECC_SAP on server SERVER_R3:
BKI0051I: Password successfully verified for node ECC_SAP on server SERVER_R3.
BKI0020I: End of program at: Wed Sep 3 15:38:29 BEIST 2008 .
BKI0021I: Elapsed time: 09 sec .
BKI0024I: Return code is: 0.
3.修改initSID.sap配置文件,使sap的session数大于等于rman_channel
test:oracle>vi initSID.sap
max_session =2
二、开始恢复
1.恢复控制文件
(1).恢复备份日志信息
test:oracle> brrestore -d util_file -b2 "#NULL" -m /oracle/SID/sapbackup/backSID.log
BR0401I BRRESTORE 7.00 (28)
BR0405I Start of file restore: rdysreel.rsf 2008-09-03 15.38.51
BR0484I BRRESTORE log file: /oracle/SID/sapbackup/rdysreel.rsf
BKI0023I: Time: 09/03/08 15:39:42 Done: 92.931 KB (100.0 %) of 92.931 KB. Estimated end time: 09/03/08 15:39:42.
BKI0054I: Time: 09/03/08 15:39:42 Object: 1 of 1 done: /oracle/SID/sapbackup/backSID.log with: 92.931 KB restored with description HE2___A0FKMG7QD5 .
BR0280I BRRESTORE time stamp: 2008-09-03 15.39.42
#FILE..... /oracle/SID/sapbackup/backSID.log
#RESTORED. HE2___A0FKMG7QD5
BKI1215I: Average transmission rate was 0.006 GB/h (0.001 MB/sec).
BKI0020I: End of program at: Wed Sep 3 15:39:43 BEIST 2008 .
BKI0021I: Elapsed time: 50 sec .
BKI0024I: Return code is: 0.
BR0280I BRRESTORE time stamp: 2008-09-03 15.39.43
BR0374I 1 of 1 file restored by backup utility
BR0230I Backup utility called successfully
BR0406I End of file restore: rdysreel.rsf 2008-09-03 15.39.43
BR0280I BRRESTORE time stamp: 2008-09-03 15.39.43
BR0402I BRRESTORE completed successfully
(2).检查备份日志时间点,并寻找其对应备份信息文件,如要恢复 2008-09-02 09.05.31 数据,则对应备份信息文件为:bdyskxlr
GVSHE503:orahe5 290> tail -f /oracle/SID/sapbackup/backSID.log
bdyrrsgq fnf 2008-08-29 11.21.16 2008-08-29 12.40.03 0 ............... 75 73 0 40 1921562076 41 1921576134 FULL online util_file ------ 7.00 (28)
bdysgqoe pnr 2008-09-01 12.16.00 2008-09-01 12.16.23 5 ............... 76 0 0 46 1921961576 0 0 PARTIAL online rman_util ------ 7.00 (28)
bdysgqsa fnr 2008-09-01 12.17.40 2008-09-01 12.17.51 5 ............... 76 0 0 46 1921961576 0 0 FULL online rman_util ------ 7.00 (28)
bdysgrbf pnr 2008-09-01 12.21.39 2008-09-01 12.24.12 5 ............... 76 0 0 46 1921961576 0 0 PARTIAL online rman_util ------ 7.00 (28)
bdysgtpl pnr 2008-09-01 12.50.21 2008-09-01 12.51.44 0 ............... 76 1 0 46 1921961576 47 1921995257 PARTIAL online rman_util ------ 7.00 (28)
bdysgwhl fnr 2008-09-01 13.20.41 2008-09-01 14.11.07 0 ............... 76 73 0 47 1921995257 48 1921997589 FULL online rman_util ------ 7.00 (28)
bdyskxjz inr 2008-09-02 09.04.47 2008-09-02 09.04.52 3 ............... 76 0 0 2 1922062890 0 0 ............ ............... ................ ...... 7.00 (28)
bdyskxlr fnr 2008-09-02 09.05.31 2008-09-02 09.57.44 0 ............... 76 73 0 2 1922062890 3 1922116988 FULL online rman_util ------ 7.00 (28)
bdyslfnt inr 2008-09-02 10.36.33 2008-09-02 10.52.39 0 ............... 76 1 0 3 1922116988 4 1922120831 INCR online rman_util ------ 7.00 (28)
bdysmtqz fnr 2008-09-02 18.08.37 2008-09-02 19.39.58 9 ............... 76 73 0 7 1922175876 8 1922783284 FULL online rman_util ------ 7.00 (28)
(3).恢复备份信息文件bdyskxlr
brrestore -d util_file -b2 "#NULL" -m /oracle/SID/sapbackup/bdyskxlr.fnr
2.根据备份信息恢复数据库控制文件
test:oracle>cd /oracle/SID/sapbackup/
test:oracle>brrestore -b bdyskxlr.fnr -m 0
3.打开数据库到mount状态
test:oracle>sqlplus '/as sysdba'
SQL>startup mount
4.开始进行全库恢复
test:oracle>brrestore -b bdyskxlr.fnr -m all
正在进行恢复,请耐心等待...
5.恢复archivelog
(1).恢复归档日志备份文件
test:oracle>brrestore -d util_file -b2 "#NULL" -m /oracle/SID/saparch/archSID.log
(2).检查归档备份文件,根据备份信息寻找要恢复的scn范围,如:2~3,开始恢复
test:oracle>brrestore -a 2-3 -d util_file
6.recover database
test:oracle>sqlplus '/as sysdba'
SQL>recover database using backup controlfile until time '2008-09-02 13:00:00';
It's recover database,pls wait...
此时数据库会从achivelog中获取最大的scn,并与controlfile和datafile_header中checkpoint_change#.如果同步成功,则controlfile和datafile_header,以及datafile中start SCN,end scn都应该一直,否则数据库恢复有问题,打不开数据库。
7.打开数据库到open状态
test:oracle>sqlplus '/as sysdba'
SQL>alter database open resetlogs
如果不是完全恢复,则必须用resetlogs方式打开。
阅读(3156) | 评论(1) | 转发(0) |