首页 > 数据库 > Oracle > Oracle 11g RMAN的常规维护
|
--查看备份的信息 RMAN> list backup;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 124 Full 659.82M DISK 00:00:35 15-AUG-13 BP Key: 124 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091552 Piece Name: /pooldisk02/backup03/4oohbim9_1_1 List of Datafiles in backup set 124 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 2818474 15-AUG-13 /oradata/system01.dbf 3 Full 2818474 15-AUG-13 /oradata/undotbs01.dbf 7 Full 2818474 15-AUG-13 /oradata/fbtbs01.dbf 8 Full 2818474 15-AUG-13 /oradata/users02.dbf 9 Full 2818474 15-AUG-13 /oradata/mynewts01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 125 Full 659.01M DISK 00:01:16 15-AUG-13 BP Key: 125 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091552 Piece Name: /pooldisk02/backup04/4pohbim9_1_1 List of Datafiles in backup set 125 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 2 Full 2818476 15-AUG-13 /oradata/sysaux01.dbf 4 Full 2818476 15-AUG-13 /oradata/users01.dbf 5 Full 2818476 15-AUG-13 /oradata/example01.dbf 6 Full 2818476 15-AUG-13 /oradata/newts01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 126 Full 9.95M DISK 00:00:01 15-AUG-13 BP Key: 126 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091718 Piece Name: /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823511838_90srqhbv_.bkp SPFILE Included: Modification time: 15-AUG-13 SPFILE db_unique_name: TESTDB11 Control File Included: Ckp SCN: 2818517 Ckp time: 15-AUG-13
--备份片所对应的物理文件损坏 [oracle@S1011:/export/home/oracle]$ rm /pooldisk02/backup03/4oohbim9_1_1
--对备份进行验证 RMAN> crosscheck backup;
using channel ORA_DISK_1 using channel ORA_DISK_2 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/pooldisk02/backup04/4pohbim9_1_1 RECID=125 STAMP=823511788 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823511838_90srqhbv_.bkp RECID=126 STAMP=823511839 Crosschecked 2 objects
crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/pooldisk02/backup03/4oohbim9_1_1 RECID=124 STAMP=823511753 Crosschecked 1 objects
--再次查看,发现状态已经改变 RMAN> list backup;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 124 Full 659.82M DISK 00:00:35 15-AUG-13 BP Key: 124 Status: EXPIRED Compressed: NO Tag: TAG20130815T091552 Piece Name: /pooldisk02/backup03/4oohbim9_1_1 List of Datafiles in backup set 124 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 2818474 15-AUG-13 /oradata/system01.dbf 3 Full 2818474 15-AUG-13 /oradata/undotbs01.dbf 7 Full 2818474 15-AUG-13 /oradata/fbtbs01.dbf 8 Full 2818474 15-AUG-13 /oradata/users02.dbf 9 Full 2818474 15-AUG-13 /oradata/mynewts01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 125 Full 659.01M DISK 00:01:16 15-AUG-13 BP Key: 125 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091552 Piece Name: /pooldisk02/backup04/4pohbim9_1_1 List of Datafiles in backup set 125 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 2 Full 2818476 15-AUG-13 /oradata/sysaux01.dbf 4 Full 2818476 15-AUG-13 /oradata/users01.dbf 5 Full 2818476 15-AUG-13 /oradata/example01.dbf 6 Full 2818476 15-AUG-13 /oradata/newts01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 126 Full 9.95M DISK 00:00:01 15-AUG-13 BP Key: 126 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091718 Piece Name: /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823511838_90srqhbv_.bkp SPFILE Included: Modification time: 15-AUG-13 SPFILE db_unique_name: TESTDB11 Control File Included: Ckp SCN: 2818517 Ckp time: 15-AUG-13\ --删除expired的备份 RMAN> delete expired backup;
using channel ORA_DISK_1 using channel ORA_DISK_2
List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 124 124 1 1 EXPIRED DISK /pooldisk02/backup03/4oohbim9_1_1
Do you really want to delete the above objects (enter YES or NO)? y deleted backup piece backup piece handle=/pooldisk02/backup03/4oohbim9_1_1 RECID=124 STAMP=823511753 Deleted 1 EXPIRED objects --再次查看 RMAN> list backup;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 125 Full 659.01M DISK 00:01:16 15-AUG-13 BP Key: 125 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091552 Piece Name: /pooldisk02/backup04/4pohbim9_1_1 List of Datafiles in backup set 125 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 2 Full 2818476 15-AUG-13 /oradata/sysaux01.dbf 4 Full 2818476 15-AUG-13 /oradata/users01.dbf 5 Full 2818476 15-AUG-13 /oradata/example01.dbf 6 Full 2818476 15-AUG-13 /oradata/newts01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 126 Full 9.95M DISK 00:00:01 15-AUG-13 BP Key: 126 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091718 Piece Name: /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823511838_90srqhbv_.bkp SPFILE Included: Modification time: 15-AUG-13 SPFILE db_unique_name: TESTDB11 Control File Included: Ckp SCN: 2818517 Ckp time: 15-AUG-13
--备份归档日志文件,需要备份的归档已经被删除 RMAN> backup archivelog all;
Starting backup at 15-AUG-13 current log archived using channel ORA_DISK_1 using channel ORA_DISK_2 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 08/15/2013 09:26:22 RMAN-06059: expected archived log not found, loss of archived log compromises recoverability ORA-19625: error identifying file /archive1/1_93_813665348.dbf ORA-27037: unable to obtain file status Solaris-AMD64 Error: 2: No such file or directory Additional information: 3
--执行对归档的crosscheck RMAN> crosscheck archivelog all;
released channel: ORA_DISK_1 released channel: ORA_DISK_2 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=18 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=19 device type=DISK validation succeeded for archived log archived log file name=/archive1/1_1_823454100.dbf RECID=111 STAMP=823455098 validation succeeded for archived log archived log file name=/archive2/1_1_823454100.dbf RECID=112 STAMP=823455098 .... --然后再进行归档 RMAN> backup archivelog all;
Starting backup at 15-AUG-13 current log archived using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=112 STAMP=823455098 channel ORA_DISK_1: starting piece 1 at 15-AUG-13 channel ORA_DISK_2: starting archived log backup set .... 超出保留期策略的备份 RMAN> report obsolete;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 143 15-AUG-13 Backup Piece 143 15-AUG-13 /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823522136_90t2s8jm_.bkp Backup Set 144 15-AUG-13 Backup Piece 144 15-AUG-13 /pooldisk02/backup03/5dohc1qr_1_1 Backup Set 145 15-AUG-13 Backup Piece 145 15-AUG-13 /pooldisk02/backup04/5eohc1qr_1_1 Backup Set 146 15-AUG-13 Backup Piece 146 15-AUG-13 /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823527260_90t7sdq6_.bkp --删除备份 delete backup; --删除镜像拷贝 delete copy; --删除时不要提示 delete noprompt backup; --删除超出保留策略的备份(冗余度;备份窗口) delete obsolete; --查看当前的保留策略 RMAN> show all;
using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/pooldisk02/backup03/%U'; CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/pooldisk02/backup04/%U'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TestDB11.f'; # default --根据保留策略计算目前需要备份的对象 RMAN> report need backup;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of files with less than 1 redundant backups File #bkps Name ---- ----- ----------------------------------------------------- 1 0 /oradata/system01.dbf 3 0 /oradata/undotbs01.dbf 7 0 /oradata/fbtbs01.dbf 8 0 /oradata/users02.dbf 9 0 /oradata/mynewts01.dbf --执行备份 RMAN> backup database; --再次查看,根据目前的保留策略,已经不需要其它的备份了 RMAN> report need backup;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of files with less than 1 redundant backups File #bkps Name ---- ----- -----------------------------------------------------
--查看一下当前users表空间中的备份 RMAN> list backup of tablespace users;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 125 Full 659.01M DISK 00:01:16 15-AUG-13 BP Key: 125 Status: AVAILABLE Compressed: NO Tag: TAG20130815T091552 Piece Name: /pooldisk02/backup04/4pohbim9_1_1 List of Datafiles in backup set 125 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2818476 15-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 140 Full 630.66M DISK 00:01:06 15-AUG-13 BP Key: 140 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup03/58ohbrh8_1_1 List of Datafiles in backup set 140 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2826448 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 141 Full 659.67M DISK 00:01:37 15-AUG-13 BP Key: 141 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup04/59ohbrh8_1_1 List of Datafiles in backup set 141 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2826450 15-AUG-13 /oradata/users01.dbf
--按目前的保留期策略,应该有多余的,可以被删除掉 RMAN> report obsolete;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Archive Log 1 13-AUG-13 /archive1/1_93_813665348.dbf Archive Log 3 13-AUG-13 /archive1/1_94_813665348.dbf .... Archive Log 159 15-AUG-13 /archive2/1_8_823462113.dbf Archive Log 160 15-AUG-13 /archive1/1_6_823462113.dbf Archive Log 161 15-AUG-13 /archive2/1_6_823462113.dbf Archive Log 156 15-AUG-13 /archive1/1_7_823462113.dbf Archive Log 168 15-AUG-13 /archive1/1_1_823501233.dbf Archive Log 169 15-AUG-13 /archive2/1_1_823501233.dbf Backup Set 125 15-AUG-13 Backup Piece 125 15-AUG-13 /pooldisk02/backup04/4pohbim9_1_1 Archive Log 170 15-AUG-13 /archive1/1_1_823511482.dbf Backup Set 126 15-AUG-13 Backup Piece 126 15-AUG-13 /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823511838_90srqhbv_.bkp Archive Log 171 15-AUG-13 /archive2/1_1_823511482.dbf Archive Log 172 15-AUG-13 /archive1/1_2_823511482.dbf Archive Log 173 15-AUG-13 /archive2/1_2_823511482.dbf Backup Set 127 15-AUG-13 Backup Piece 127 15-AUG-13 /pooldisk02/backup03/4rohbjel_1_1 Backup Set 128 15-AUG-13 Backup Piece 128 15-AUG-13 /pooldisk02/backup04/4sohbjel_1_1
--删除多余的 RMAN> delete obsolete; RMAN> report obsolete; RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 no obsolete backups found
--删除具体的备份 RMAN> list backup;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 140 Full 630.66M DISK 00:01:06 15-AUG-13 BP Key: 140 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup03/58ohbrh8_1_1 List of Datafiles in backup set 140 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 2826448 15-AUG-13 /oradata/system01.dbf 3 Full 2826448 15-AUG-13 /oradata/undotbs01.dbf 7 Full 2826448 15-AUG-13 /oradata/fbtbs01.dbf 8 Full 2826448 15-AUG-13 /oradata/users02.dbf 9 Full 2826448 15-AUG-13 /oradata/mynewts01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 141 Full 659.67M DISK 00:01:37 15-AUG-13 BP Key: 141 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup04/59ohbrh8_1_1 List of Datafiles in backup set 141 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 2 Full 2826450 15-AUG-13 /oradata/sysaux01.dbf 4 Full 2826450 15-AUG-13 /oradata/users01.dbf 5 Full 2826450 15-AUG-13 /oradata/example01.dbf 6 Full 2826450 15-AUG-13 /oradata/newts01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 142 Full 10.23M DISK 00:00:01 15-AUG-13 BP Key: 142 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114835 Piece Name: /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823520915_90t1m4dk_.bkp SPFILE Included: Modification time: 15-AUG-13 SPFILE db_unique_name: TESTDB11 Control File Included: Ckp SCN: 2826505 Ckp time: 15-AUG-13
--只删除142备份集 RMAN> delete backupset 142;
using channel ORA_DISK_1 using channel ORA_DISK_2
List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 142 142 1 1 AVAILABLE DISK /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823520915_90t1m4dk_.bkp
Do you really want to delete the above objects (enter YES or NO)? y deleted backup piece backup piece handle=/u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823520915_90t1m4dk_.bkp RECID=142 STAMP=823520916 Deleted 1 objects
--查看备份拷贝,当前没有 RMAN> list copy;
specification does not match any datafile copy in the repository specification does not match any control file copy in the repository specification does not match any archived log in the repository --创建一个 RMAN> backup as copy datafile 9;
Starting backup at 15-AUG-13 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting datafile copy input datafile file number=00009 name=/oradata/mynewts01.dbf output file name=/pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-MYNEWTS_FNO-9_5bohbsqk tag=TAG20130815T120852 RECID=52 STAMP=823522134 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 15-AUG-13
Starting Control File and SPFILE Autobackup at 15-AUG-13 piece handle=/u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823522136_90t2s8jm_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 15-AUG-13 --再次查看备份拷贝 RMAN> list copy;
specification does not match any control file copy in the repository specification does not match any archived log in the repository List of Datafile Copies =======================
Key File S Completion Time Ckp SCN Ckp Time ------- ---- - --------------- ---------- --------------- 52 9 A 15-AUG-13 2827755 15-AUG-13 Name: /pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-MYNEWTS_FNO-9_5bohbsqk Tag: TAG20130815T120852
--删除备份拷贝 RMAN> delete copy;
released channel: ORA_DISK_1 released channel: ORA_DISK_2 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=35 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=22 device type=DISK specification does not match any control file copy in the repository specification does not match any archived log in the repository List of Datafile Copies =======================
Key File S Completion Time Ckp SCN Ckp Time ------- ---- - --------------- ---------- --------------- 52 9 A 15-AUG-13 2827755 15-AUG-13 Name: /pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-MYNEWTS_FNO-9_5bohbsqk Tag: TAG20130815T120852
Do you really want to delete the above objects (enter YES or NO)? y deleted datafile copy datafile copy file name=/pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-MYNEWTS_FNO-9_5bohbsqk RECID=52 STAMP=823522134 Deleted 1 objects
-- 报告需要的备份 RMAN> report need backup;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of files with less than 1 redundant backups File #bkps Name ---- ----- -----------------------------------------------------
--报告超出保留策略的备份 RMAN> report obsolete;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 no obsolete backups found --查看方案的信息 RMAN> report schema;
Report of database schema for database with db_unique_name TESTDB11
List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 750 SYSTEM *** /oradata/system01.dbf 2 740 SYSAUX *** /oradata/sysaux01.dbf 3 290 UNDOTBS1 *** /oradata/undotbs01.dbf 4 6 USERS *** /oradata/users01.dbf 5 345 EXAMPLE *** /oradata/example01.dbf 6 20 NEWTS *** /oradata/newts01.dbf 7 200 FBTBS *** /oradata/fbtbs01.dbf 8 50 USERS *** /oradata/users02.dbf 9 20 MYNEWTS *** /oradata/mynewts01.dbf
List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- -------------------- ----------- -------------------- 1 500 TEMP 500 /oradata/temp01.dbf
--备份users表空间(执行2次) RMAN> backup tablespace users; --查看备份 RMAN> list backup of tablespace users;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 140 Full 630.66M DISK 00:01:06 15-AUG-13 BP Key: 140 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup03/58ohbrh8_1_1 List of Datafiles in backup set 140 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2826448 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 141 Full 659.67M DISK 00:01:37 15-AUG-13 BP Key: 141 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup04/59ohbrh8_1_1 List of Datafiles in backup set 141 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2826450 15-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 144 Full 2.58M DISK 00:00:00 15-AUG-13 BP Key: 144 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133419 Piece Name: /pooldisk02/backup03/5dohc1qr_1_1 List of Datafiles in backup set 144 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2831857 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 145 Full 5.23M DISK 00:00:01 15-AUG-13 BP Key: 145 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133419 Piece Name: /pooldisk02/backup04/5eohc1qr_1_1 List of Datafiles in backup set 145 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2831859 15-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 147 Full 2.58M DISK 00:00:00 15-AUG-13 BP Key: 147 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133429 Piece Name: /pooldisk02/backup03/5gohc1r5_1_1 List of Datafiles in backup set 147 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2831884 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 148 Full 5.23M DISK 00:00:01 15-AUG-13 BP Key: 148 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133429 Piece Name: /pooldisk02/backup04/5hohc1r5_1_1 List of Datafiles in backup set 148 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2831886 15-AUG-13 /oradata/users01.dbf
--改变148备份集的状态 RMAN> change backupset 148 unavailable;
changed backup piece unavailable backup piece handle=/pooldisk02/backup04/5hohc1r5_1_1 RECID=148 STAMP=823527269 Changed 1 objects to UNAVAILABLE status
--再次查看 RMAN> list backup of tablespace users;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 140 Full 630.66M DISK 00:01:06 15-AUG-13 BP Key: 140 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup03/58ohbrh8_1_1 List of Datafiles in backup set 140 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2826448 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 141 Full 659.67M DISK 00:01:37 15-AUG-13 BP Key: 141 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup04/59ohbrh8_1_1 List of Datafiles in backup set 141 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2826450 15-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 144 Full 2.58M DISK 00:00:00 15-AUG-13 BP Key: 144 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133419 Piece Name: /pooldisk02/backup03/5dohc1qr_1_1 List of Datafiles in backup set 144 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2831857 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 145 Full 5.23M DISK 00:00:01 15-AUG-13 BP Key: 145 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133419 Piece Name: /pooldisk02/backup04/5eohc1qr_1_1 List of Datafiles in backup set 145 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2831859 15-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 147 Full 2.58M DISK 00:00:00 15-AUG-13 BP Key: 147 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133429 Piece Name: /pooldisk02/backup03/5gohc1r5_1_1 List of Datafiles in backup set 147 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2831884 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 148 Full 5.23M DISK 00:00:01 15-AUG-13 BP Key: 148 Status: UNAVAILABLE Compressed: NO Tag: TAG20130815T133429 Piece Name: /pooldisk02/backup04/5hohc1r5_1_1 List of Datafiles in backup set 148 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2831886 15-AUG-13 /oradata/users01.dbf
--测试一下还原使用哪个备份,是148前一个147,因为148已经被修改为unavailable RMAN> sql 'alter tablespace users offline';
sql statement: alter tablespace users offline
RMAN> restore tablespace users;
Starting restore at 15-AUG-13 using channel ORA_DISK_1 using channel ORA_DISK_2
channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00004 to /oradata/users01.dbf channel ORA_DISK_1: reading from backup piece /pooldisk02/backup04/5eohc1qr_1_1 channel ORA_DISK_2: starting datafile backup set restore channel ORA_DISK_2: specifying datafile(s) to restore from backup set channel ORA_DISK_2: restoring datafile 00008 to /oradata/users02.dbf channel ORA_DISK_2: reading from backup piece /pooldisk02/backup03/5gohc1r5_1_1 channel ORA_DISK_1: piece handle=/pooldisk02/backup04/5eohc1qr_1_1 tag=TAG20130815T133419 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 channel ORA_DISK_2: piece handle=/pooldisk02/backup03/5gohc1r5_1_1 tag=TAG20130815T133429 channel ORA_DISK_2: restored backup piece 1 channel ORA_DISK_2: restore complete, elapsed time: 00:00:03 Finished restore at 15-AUG-13
RMAN> recover tablespace users;
Starting recover at 15-AUG-13 using channel ORA_DISK_1 using channel ORA_DISK_2
starting media recovery media recovery complete, elapsed time: 00:00:00
Finished recover at 15-AUG-13
RMAN> sql 'alter tablespace users online';
sql statement: alter tablespace users online
--将状态改回来 RMAN> change backupset 148 available;
using channel ORA_DISK_1 using channel ORA_DISK_2 changed backup piece available backup piece handle=/pooldisk02/backup04/5hohc1r5_1_1 RECID=148 STAMP=823527269 Changed 1 objects to AVAILABLE status
RMAN> list backup of tablespace users;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 140 Full 630.66M DISK 00:01:06 15-AUG-13 BP Key: 140 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup03/58ohbrh8_1_1 List of Datafiles in backup set 140 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2826448 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 141 Full 659.67M DISK 00:01:37 15-AUG-13 BP Key: 141 Status: AVAILABLE Compressed: NO Tag: TAG20130815T114647 Piece Name: /pooldisk02/backup04/59ohbrh8_1_1 List of Datafiles in backup set 141 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2826450 15-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 144 Full 2.58M DISK 00:00:00 15-AUG-13 BP Key: 144 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133419 Piece Name: /pooldisk02/backup03/5dohc1qr_1_1 List of Datafiles in backup set 144 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2831857 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 145 Full 5.23M DISK 00:00:01 15-AUG-13 BP Key: 145 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133419 Piece Name: /pooldisk02/backup04/5eohc1qr_1_1 List of Datafiles in backup set 145 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2831859 15-AUG-13 /oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 147 Full 2.58M DISK 00:00:00 15-AUG-13 BP Key: 147 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133429 Piece Name: /pooldisk02/backup03/5gohc1r5_1_1 List of Datafiles in backup set 147 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 8 Full 2831884 15-AUG-13 /oradata/users02.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 148 Full 5.23M DISK 00:00:01 15-AUG-13 BP Key: 148 Status: AVAILABLE Compressed: NO Tag: TAG20130815T133429 Piece Name: /pooldisk02/backup04/5hohc1r5_1_1 List of Datafiles in backup set 148 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2831886 15-AUG-13 /oradata/users01.dbf
--查看当前的保留策略 RMAN> show retention policy;
RMAN configuration parameters for database with db_unique_name TESTDB11 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
--查看超出保留期策略的备份 RMAN> report obsolete;
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 154 15-AUG-13 Backup Piece 154 15-AUG-13 /pooldisk02/backup03/5nohcb0a_1_1 Backup Set 155 15-AUG-13 Backup Piece 155 15-AUG-13 /pooldisk02/backup04/5oohcb0a_1_1 Backup Set 156 15-AUG-13 Backup Piece 156 15-AUG-13 /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_15/o1_mf_s_823536651_90tjyvlg_.bkp
|
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30633755/viewspace-2127661/ ,如需转载,请注明出处,否则将追究法律责任。