一.备份集放在带库上
>>>>>注册带库上的备份集需要注意,要分别配置到每个实例的SBT通道来注册
1.查看带库上的备份集信息
2.连接catalog库(如果使用了catalog库的话)
rman target sys/*****@test1 catalog rmannew/*****@test2
1)
configure CHANNEL device type 'SBT_TAPE' PARMS 'ENV=(NB_ORA_POLICY=backupfullbidb3,NB_ORA_SERV=nbumaster-1,NB_ORA_CLIENT=bidb1)';
>>>>>本地通道
2)
configure CHANNEL device type 'SBT_TAPE' connect 'sys/******@bidb2' PARMS 'ENV=(NB_ORA_POLICY=backupfullbidb4,NB_ORA_SERV=nbumaster-1,NB_ORA_CLIENT=bidb2)';
>>>>>指向其他实例的通过
由第二个实例上通道上产生的备份集需要用第二个实例上的通道来注册(因为带库上第二个实例上通道备份的数据,只有第二个实例上的通道才能读取),所以我们需要把所有备份集在两个通道上都注册一遍(第二个实例产生的备份集在第一个实例的通道上注册会报错)
##配置时指定的参数NB_ORA_POLICY--备份策略,NB_ORA_SERV--nub服务器,NB_ORA_CLIENT--进行备份的客户端 需要根据备份脚本中一致(参考你的备份脚本指定)
3.开始注册
CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 'bk_77102_1_877401621';
成功输出如下:
RMAN> CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 'bk_77085_1_877386830'; released channel: ORA_SBT_TAPE_1 released channel: ORA_SBT_TAPE_2 released channel: ORA_SBT_TAPE_3 released channel: ORA_SBT_TAPE_4 allocated channel: ORA_SBT_TAPE_1 channel ORA_SBT_TAPE_1: SID=1729 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_2 channel ORA_SBT_TAPE_2: SID=1796 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_2: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_3 channel ORA_SBT_TAPE_3: SID=1858 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_3: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_4 channel ORA_SBT_TAPE_4: SID=1921 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_4: Veritas NetBackup for Oracle - Release 7.6 (2013111319) cataloged backup piece backup piece handle=bk_77085_1_877386830 RECID=77345 STAMP=878233446
##在本地实例通道上注册其他实例通道上产生的备份集失败,配置连接到第二个实例上的通过再次注册后成功
在第一个实例上配置通道注册bk_77102_1_877401621备份集失败 RMAN> configure CHANNEL device type 'SBT_TAPE' PARMS 'ENV=(NB_ORA_POLICY=backupfullbidb3,NB_ORA_SERV=nbumaster-1,NB_ORA_CLIENT=bidb1)'; RMAN> CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 'bk_77102_1_877401621'; allocated channel: ORA_SBT_TAPE_1 channel ORA_SBT_TAPE_1: SID=2081 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_2 channel ORA_SBT_TAPE_2: SID=2241 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_2: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_3 channel ORA_SBT_TAPE_3: SID=2785 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_3: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_4 channel ORA_SBT_TAPE_4: SID=2817 instance=bidb1 device type=SBT_TAPE channel ORA_SBT_TAPE_4: Veritas NetBackup for Oracle - Release 7.6 (2013111319) ORA-19870: error while restoring backup piece bk_77102_1_877401621 ORA-19507: failed to retrieve sequential file, handle="bk_77102_1_877401621", parms="" ORA-27029: skgfrtrv: sbtrestore returned error ORA-19511: Error received from media manager layer, error text: Failed to open backup file for restore. RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of catalog command at 04/29/2015 17:21:03 RMAN-06209: List of failed objects RMAN-06211: ========================== RMAN-06212: Object Type Filename/Handle RMAN-06213: --------------- --------------------------------------------------- RMAN-06214: Backup Piece bk_77102_1_877401621 配置连接到第二个实例的通道,再次注册bk_77102_1_877401621备份片成功 RMAN> configure CHANNEL device type 'SBT_TAPE' connect 'sys/******@bidb2' PARMS 'ENV=(NB_ORA_POLICY=backupfullbidb4,NB_ORA_SERV=nbumaster-1,NB_ORA_CLIENT=bidb2)'; old RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'ENV=(NB_ORA_POLICY=backupfullbidb4,NB_ORA_SERV=nbumaster-1,NB_ORA_CLIENT=bidb2)'; new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' CONNECT '*' PARMS 'ENV=(NB_ORA_POLICY=backupfullbidb4,NB_ORA_SERV=nbumaster-1,NB_ORA_CLIENT=bidb2)'; new RMAN configuration parameters are successfully stored released channel: ORA_SBT_TAPE_1 released channel: ORA_SBT_TAPE_2 released channel: ORA_SBT_TAPE_3 released channel: ORA_SBT_TAPE_4 starting full resync of recovery catalog full resync complete RMAN> CATALOG DEVICE TYPE 'SBT_TAPE' BACKUPPIECE 'bk_77102_1_877401621'; allocated channel: ORA_SBT_TAPE_1 channel ORA_SBT_TAPE_1: SID=1924 instance=bidb2 device type=SBT_TAPE channel ORA_SBT_TAPE_1: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_2 channel ORA_SBT_TAPE_2: SID=2145 instance=bidb2 device type=SBT_TAPE channel ORA_SBT_TAPE_2: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_3 channel ORA_SBT_TAPE_3: SID=2337 instance=bidb2 device type=SBT_TAPE channel ORA_SBT_TAPE_3: Veritas NetBackup for Oracle - Release 7.6 (2013111319) allocated channel: ORA_SBT_TAPE_4 channel ORA_SBT_TAPE_4: SID=2435 instance=bidb2 device type=SBT_TAPE channel ORA_SBT_TAPE_4: Veritas NetBackup for Oracle - Release 7.6 (2013111319) cataloged backup piece backup piece handle=bk_77102_1_877401621 RECID=77407 STAMP=878318781 RMAN>
二.备份集放在每个实例的本地文件系统上
>>>>>如果备份集放在rac每个实例的本地磁盘上,我们需要分别在每个节点分别注册它们的备份集。(在第一个实例上分配到第二个实例的通道,注册第二个实例上的备份集也无法成功)
1) 在实例1上注册实例1上产生的备份集
rman target /
catalog backuppiect '';
2)在实例2上注册实例2上产生的备份集
catalog backuppiece '';
3)检查备份集是否注册成功
list backupset of databaes;
4)crosscheck 备份集
run
{
allocate channel c1 type disk connect 'sys/*****@testdb1';
allocate channel c2 type disk connect 'sys/*****@testdb2';
crosscheck backupset of database;
release channel c1;
release channel c2;
}
##注意如果你的备份集是通过多个实例上的通道产生,并且放在本地的,那么crosscheck时要分配到每个实例的通道,否则,如果你在第一个实例上crosscheck,会发现第二个实例上的backupset会被标记为expired状态
三.备份集放在共享文件系统上
>>>>>如果你的备份集是放在共享文件系统上,无论你是否使用多个实例上的通道进行备份,你都可以在任意一个实例上成功注册所有的备份集
1.通过如下备份脚本进行备份
run { allocate channel c1 type disk connect 'sys/******@test1'; allocate channel c2 type disk connect 'sys/******@test2'; backup as backupset tablespace TBS_CHANNEL format '/data01/backup/egcmc/TBS_*****01_%d_%T_%s_%p'; release channel c1; release channel c2; }##在两个实例上分配通道,进行备份,备份集放在蚊香文件系统上
2.mv 共享文件系统上的备份集到其他位置
3.crosscheck backupset of database;
crosscheck backupset of database; using channel ORA_SBT_TAPE_1 using channel ORA_SBT_TAPE_2 using channel ORA_SBT_TAPE_3 using channel ORA_SBT_TAPE_4 using channel ORA_DISK_1 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/data01/backup/TBS_CHANNEL01_*****_20150612_34307_1 RECID=33774 STAMP=882197130 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/data01/backup/TBS_CHANNEL01_*****_20150612_34308_1 RECID=33775 STAMP=882197156 Crosschecked 2 objects##此时两个备份集都显示为expired状态
4.delete noprompt expired backupset;
delete noprompt expired backupset; using channel ORA_SBT_TAPE_1 using channel ORA_SBT_TAPE_2 using channel ORA_SBT_TAPE_3 using channel ORA_SBT_TAPE_4 using channel ORA_DISK_1 List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 33774 33771 1 1 EXPIRED DISK /data01/backup/TBS_CHANNEL01_****_20150612_34307_1 33775 33772 1 1 EXPIRED DISK /data01/backup/TBS_CHANNEL01_****_20150612_34308_1 deleted backup piece backup piece handle=/data01/backup/TBS_CHANNEL01_****_20150612_34307_1 RECID=33774 STAMP=882197130 deleted backup piece backup piece handle=/data01/backup/TBS_CHANNEL01_****_20150612_34308_1 RECID=33775 STAMP=882197156 Deleted 2 EXPIRED objects RMAN> list backupset of database; specification does not match any backup in the repository##删除控制文件中状态为EXPIRED的备份集
5.重新注册备份集信息到控制文件(任意一个节点上尝试都能成功注册)
>>>>>可以在任意一个节点上执行catalog命令
RMAN> catalog backuppiece '/data01/backup/egcmc/TBS_CHANNEL01_****_20150612_34307_1'; cataloged backup piece backup piece handle=/data01/backup/egcmc/TBS_CHANNEL01_****_20150612_34307_1 RECID=33776 STAMP=882197384 RMAN> catalog backuppiece '/data01/backup/egcmc/TBS_CHANNEL01_****_20150612_34308_1'; cataloged backup piece backup piece handle=/data01/backup/egcmc/TBS_CHANNEL01_****_20150612_34308_1 RECID=33777 STAMP=882197402 6.list backupset of database; RMAN> list backupset of database; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 33773 Full 57.25G DISK 00:00:00 12-JUN-15 BP Key: 33776 Status: AVAILABLE Compressed: NO Tag: TAG20150612T111336 Piece Name: /data01/backup/egcmc/TBS_CHANNEL01_****_20150612_34307_1 List of Datafiles in backup set 33773 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 5 Full 293096434951 12-JUN-15 /data01/egcmcdb/datafile/tbs_channel01.dbf 6 Full 293096434951 12-JUN-15 /data01/egcmcdb/datafile/tbs_channel02.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 33774 Full 29.47G DISK 00:00:00 12-JUN-15 BP Key: 33777 Status: AVAILABLE Compressed: NO Tag: TAG20150612T111336 Piece Name: /data01/backup/egcmc/TBS_CHANNEL01_****_20150612_34308_1 List of Datafiles in backup set 33774 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 7 Full 293096434954 12-JUN-15 /data01/egcmcdb/datafile/tbs_channel03.dbf##注册成功