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部落格 ” ,連結:http://blog.itpub.net/30633755/viewspace-2127661/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 11g data guard維護Oracle
- ORACLE 11G 維護視窗和自動維護任務Oracle
- ORACLE 11G 自動維護任務Oracle
- oracle實驗記錄 (恢復-rman維護(1))Oracle
- oracle實驗記錄 (恢復-rman維護(2))Oracle
- RMAN配置與維護命令
- rman維護歸檔日誌
- Oracle 索引的維護Oracle索引
- 【Oracle】Oracle 11g 中的自動資料庫維護任務管理Oracle資料庫
- ORACLE 11G RAC--維護叢集的OCR命令介紹Oracle
- LightDB-高可用主庫常規維護重啟操作
- 11G RAC OLR維護命令
- oracle 11g rman backup scriptOracle
- 使用RMAN執行維護操作——RMAN使用者手冊
- oracle分割槽表的維護Oracle
- oracle goldengate維護OracleGo
- Oracle RAC 日常維護Oracle
- Oracle RAC維護命令Oracle
- oracle維護相關Oracle
- oracle 維護常用SQLOracleSQL
- dataguard 常規運維操作運維
- 伺服器安全維護常識伺服器
- Oracle 11g Rman Active database duplicateOracleDatabase
- 收集oracle日常維護的工作命令Oracle
- oracle常用維護查詢Oracle
- Oracle OGG日常維護Oracle
- Oracle AWR管理與維護Oracle
- 針對oracle日常維護Oracle
- Oracle之Rman常見錯誤Oracle
- oracle 11g RAC 啟動和關閉和一些維護命令Oracle
- Oracle 11g RMAN備份-基本操作Oracle
- Oracle 11g RMAN 異機恢復Oracle
- linux中oracle的日常維護命令LinuxOracle
- Oracle統計資訊的收集和維護Oracle
- 網路規劃設計管理維護
- 淺析雲伺服器常見的維護技巧伺服器
- ORACLE user profile配置/管理/維護Oracle
- ORACLE DG 日常維護常用SQLOracleSQL