一、实验环境
1)查看已有备份集
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
411 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
412 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
413 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
414 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
416 B A A DISK 09-MAR-16 1 1 NO ARC_BAK
417 B A A DISK 09-MAR-16 1 1 NO ARC_BAK
418 B A A DISK 09-MAR-16 1 1 NO ARC_BAK
419 B F A DISK 09-MAR-16 1 1 NO CTLFILE_BAK
420 B F A DISK 09-MAR-16 1 1 NO SPFILE_BAK
2)原备份路径为/home/oracle/backup修改成/home/oracle/bak/
3)crosscheck备份集,发现已全部标记为EXPIRED
RMAN> crosscheck backup;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_lv0_e6r02vfk_1_1_20160309 RECID=411 STAMP=906067446
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_lv0_e3r02vfk_1_1_20160309 RECID=412 STAMP=906067444
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_lv0_e4r02vfk_1_1_20160309 RECID=413 STAMP=906067446
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_lv0_e5r02vfk_1_1_20160309 RECID=414 STAMP=906067446
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_arch_e8r02vi2_1_1_20160309 RECID=416 STAMP=906067522
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_arch_e9r02vi2_1_1_20160309 RECID=417 STAMP=906067522
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_arch_ear02vi2_1_1_20160309 RECID=418 STAMP=906067522
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/home/oracle/backup/neal_ctlfile_ebr02vi3_1_1_20160309 RECID=419 STAMP=906067524
crosschecked backup piece: found to be 'EXPIRED'
4)备份集中Status=X表示备份集已失效RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
411 B 0 X DISK 09-MAR-16 1 1 NO NEAL_LV0
412 B 0 X DISK 09-MAR-16 1 1 NO NEAL_LV0
413 B 0 X DISK 09-MAR-16 1 1 NO NEAL_LV0
414 B 0 X DISK 09-MAR-16 1 1 NO NEAL_LV0
416 B A X DISK 09-MAR-16 1 1 NO ARC_BAK
417 B A X DISK 09-MAR-16 1 1 NO ARC_BAK
418 B A X DISK 09-MAR-16 1 1 NO ARC_BAK
419 B F X DISK 09-MAR-16 1 1 NO CTLFILE_BAK
420 B F X DISK 09-MAR-16 1 1 NO SPFILE_BAK
5)删除expired的备份集信息
RMAN> delete noprompt expired backup;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
411 411 1 1 EXPIRED DISK /home/oracle/backup/neal_lv0_e6r02vfk_1_1_20160309
412 412 1 1 EXPIRED DISK /home/oracle/backup/neal_lv0_e3r02vfk_1_1_20160309
413 413 1 1 EXPIRED DISK /home/oracle/backup/neal_lv0_e4r02vfk_1_1_20160309
414 414 1 1 EXPIRED DISK /home/oracle/backup/neal_lv0_e5r02vfk_1_1_20160309
416 416 1 1 EXPIRED DISK /home/oracle/backup/neal_arch_e8r02vi2_1_1_20160309
417 417 1 1 EXPIRED DISK /home/oracle/backup/neal_arch_e9r02vi2_1_1_20160309
418 418 1 1 EXPIRED DISK /home/oracle/backup/neal_arch_ear02vi2_1_1_20160309
419 419 1 1 EXPIRED DISK /home/oracle/backup/neal_ctlfile_ebr02vi3_1_1_20160309
420 420 1 1 EXPIRED DISK /home/oracle/backup/neal_spfile_ecr02vi5_1_1_20160309
deleted backup piece
backup piece handle=/home/oracle/backup/neal_lv0_e6r02vfk_1_1_20160309 RECID=411 STAMP=906067446
deleted backup piece
backup piece handle=/home/oracle/backup/neal_lv0_e3r02vfk_1_1_20160309 RECID=412 STAMP=906067444
deleted backup piece
backup piece handle=/home/oracle/backup/neal_lv0_e4r02vfk_1_1_20160309 RECID=413 STAMP=906067446
deleted backup piece
backup piece handle=/home/oracle/backup/neal_lv0_e5r02vfk_1_1_20160309 RECID=414 STAMP=906067446
deleted backup piece
backup piece handle=/home/oracle/backup/neal_arch_e8r02vi2_1_1_20160309 RECID=416 STAMP=906067522
deleted backup piece
backup piece handle=/home/oracle/backup/neal_arch_e9r02vi2_1_1_20160309 RECID=417 STAMP=906067522
deleted backup piece
backup piece handle=/home/oracle/backup/neal_arch_ear02vi2_1_1_20160309 RECID=418 STAMP=906067522
deleted backup piece
backup piece handle=/home/oracle/backup/neal_ctlfile_ebr02vi3_1_1_20160309 RECID=419 STAMP=906067524
deleted backup piece
backup piece handle=/home/oracle/backup/neal_spfile_ecr02vi5_1_1_20160309 RECID=420 STAMP=906067525
deleted backup piece
6)再次查看发现已经没有可以用来恢复的备份集RMAN> list backup summary;
specification does not match any backup in the repository
二、重新注册备份集
1、注册单个备份片
1)使用catalog backuppiece命令来指定所需注册的备份片
RMAN> catalog backuppiece '/home/oracle/bak/neal_lv0_e6r02vfk_1_1_20160309','/home/oracle/bak/neal_lv0_e3r02vfk_1_1_20160309';
cataloged backup piece
backup piece handle=/home/oracle/bak/neal_lv0_e6r02vfk_1_1_20160309 RECID=438 STAMP=906127338
cataloged backup piece
backup piece handle=/home/oracle/bak/neal_lv0_e3r02vfk_1_1_20160309 RECID=439 STAMP=906127338
2)list命令发现已经注册到rman中
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
438 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
439 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
2、注册整个目录
1)使用catalog start with来指定备份集所在的文件目录,最好加上/
RMAN> catalog start with '/home/oracle/bak/';
--如果是ASM使用方式如下
catalog start with '+disk';
searching for all files that match the pattern /home/oracle/bak/
List of Files Unknown to the Database
=====================================
File Name: /home/oracle/bak/neal_spfile_eur04m79_1_1_20160310
File Name: /home/oracle/bak/neal_arch_err04m73_1_1_20160310
File Name: /home/oracle/bak/neal_arch_eqr04m73_1_1_20160310
File Name: /home/oracle/bak/neal_arch_e9r02vi2_1_1_20160309
File Name: /home/oracle/bak/neal_lv0_e4r02vfk_1_1_20160309
File Name: /home/oracle/bak/neal_lv0_e5r02vfk_1_1_20160309
File Name: /home/oracle/bak/neal_lv0_enr04m4j_1_1_20160310
File Name: /home/oracle/bak/neal_arch_epr04m73_1_1_20160310
File Name: /home/oracle/bak/neal_ctlfile_etr04m77_1_1_20160310
Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done
List of Cataloged Files
=======================
File Name: /home/oracle/bak/neal_spfile_eur04m79_1_1_20160310
File Name: /home/oracle/bak/neal_arch_err04m73_1_1_20160310
File Name: /home/oracle/bak/neal_arch_eqr04m73_1_1_20160310
File Name: /home/oracle/bak/neal_arch_e9r02vi2_1_1_20160309
File Name: /home/oracle/bak/neal_lv0_e4r02vfk_1_1_20160309
File Name: /home/oracle/bak/neal_lv0_e5r02vfk_1_1_20160309
File Name: /home/oracle/bak/neal_lv0_enr04m4j_1_1_20160310
File Name: /home/oracle/bak/neal_arch_epr04m73_1_1_20160310
File Name: /home/oracle/bak/neal_ctlfile_etr04m77_1_1_20160310
2)查看备份集注册情况
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
438 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
439 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
440 B F A DISK 10-MAR-16 1 1 NO SPFILE_BAK
441 B A A DISK 10-MAR-16 1 1 NO ARC_BAK
442 B A A DISK 10-MAR-16 1 1 NO ARC_BAK
443 B A A DISK 09-MAR-16 1 1 NO ARC_BAK
444 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
445 B 0 A DISK 09-MAR-16 1 1 NO NEAL_LV0
448 B F A DISK 10-MAR-16 1 1 NO CTLFILE_BAK