【RMAN】使用增量備份更新資料庫備份映象

海星星hktk發表於2014-10-08
使用增量備份更新資料庫備份映象

從檔案系統遷移資料檔案到ASM磁碟組時,可以使用RMAN對資料庫進行熱備份為映象檔案。如果資料量大,熱備過程持續時間長,熱備過程中事務比較繁忙,可以在熱備結束後再做一次增量備份,來更新熱備出來的映象檔案。

【實驗環境】

作業系統:AIX 5.3
資料庫:Oracle 10.2.0

【實驗過程】

一、0級增量熱備:

點選(此處)摺疊或開啟

  1. run {
  2. sql 'alter system archive log current';
  3. allocate channel dev1 type disk;
  4. backup as copy incremental level 0 database format '+DATA' TAG 'lxh_asm_migration';
  5. sql 'alter system archive log current';
  6. }

  1. RMAN>
  2. sql statement: alter system archive log current
  3. released channel: ORA_DISK_1
  4. released channel: ORA_DISK_2
  5. allocated channel: dev1
  6. channel dev1: sid=144 devtype=DISK
  7. Starting backup at 21-AUG-14
  8. channel dev1: starting datafile copy
  9. input datafile fno=00001 name=/u01/app/oracle/oradata/prod/system01.dbf
  10. output filename=+DATA/prod/datafile/system.259.856179627 tag=LXH_ASM_MIGRATION recid=47 stamp=856179756
  11. channel dev1: datafile copy complete, elapsed time: 00:02:15
  12. channel dev1: starting datafile copy
  13. input datafile fno=00002 name=/u01/app/oracle/oradata/prod/undotbs01.dbf
  14. output filename=+DATA/prod/datafile/undotbs1.260.856179763 tag=LXH_ASM_MIGRATION recid=48 stamp=856179907
  15. channel dev1: datafile copy complete, elapsed time: 00:02:35
  16. channel dev1: starting datafile copy
  17. input datafile fno=00003 name=/u01/app/oracle/oradata/prod/sysaux01.dbf
  18. output filename=+DATA/prod/datafile/sysaux.258.856179919 tag=LXH_ASM_MIGRATION recid=49 stamp=856180002
  19. channel dev1: datafile copy complete, elapsed time: 00:01:25
  20. channel dev1: starting datafile copy
  21. input datafile fno=00005 name=/u01/app/oracle/oradata/prod/example01.dbf
  22. output filename=+DATA/prod/datafile/example.257.856180003 tag=LXH_ASM_MIGRATION recid=50 stamp=856180045
  23. channel dev1: datafile copy complete, elapsed time: 00:00:45
  24. channel dev1: starting datafile copy
  25. input datafile fno=00004 name=/u01/app/oracle/oradata/prod/users01.dbf
  26. output filename=+DATA/prod/datafile/users.256.856180049 tag=LXH_ASM_MIGRATION recid=51 stamp=856180051
  27. channel dev1: datafile copy complete, elapsed time: 00:00:03
  28. Finished backup at 21-AUG-14

  29. Starting Control File and SPFILE Autobackup at 21-AUG-14
  30. piece handle=/arch/ctl_c-267173497-20140821-04 comment=NONE
  31. Finished Control File and SPFILE Autobackup at 21-AUG-14

  32. sql statement: alter system archive log current
  33. released channel: dev1

1級增量熱備:SCN不一致

點選(此處)摺疊或開啟

  1. run {
  2. sql 'alter system archive log current';
  3. allocate channel dev1 type disk;
  4. backup incremental level 1 for recover of copy with tag 'lxh_asm_migration' database;
  5. sql 'alter system archive log current';
  6. }

點選(此處)摺疊或開啟

  1. sql statement: alter system archive log current

  2. allocated channel: dev1
  3. channel dev1: sid=144 devtype=DISK

  4. Starting backup at 21-AUG-14
  5. channel dev1: starting compressed incremental level 1 datafile backupset
  6. channel dev1: specifying datafile(s) in backupset
  7. input datafile fno=00001 name=/u01/app/oracle/oradata/prod/system01.dbf
  8. input datafile fno=00002 name=/u01/app/oracle/oradata/prod/undotbs01.dbf
  9. input datafile fno=00003 name=/u01/app/oracle/oradata/prod/sysaux01.dbf
  10. input datafile fno=00005 name=/u01/app/oracle/oradata/prod/example01.dbf
  11. input datafile fno=00004 name=/u01/app/oracle/oradata/prod/users01.dbf
  12. channel dev1: starting piece 1 at 21-AUG-14
  13. channel dev1: finished piece 1 at 21-AUG-14
  14. piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/etpgghnv_1_1 tag=TAG20140821T115438 comment=NONE
  15. channel dev1: backup set complete, elapsed time: 00:00:03
  16. Finished backup at 21-AUG-14

  17. Starting Control File and SPFILE Autobackup at 21-AUG-14
  18. piece handle=/arch/ctl_c-267173497-20140821-05 comment=NONE
  19. Finished Control File and SPFILE Autobackup at 21-AUG-14

  20. sql statement: alter system archive log current
  21. released channel: dev1
RMAN> list copy of database;
檢視copy檔案中資料檔案的SCN號,不一致。



refresh copySCN一致

點選(此處)摺疊或開啟

  1. RMAN> recover copy of database with tag 'lxh_asm_migration';
  2. Starting recover at 21-AUG-14
  3. using channel ORA_DISK_1
  4. using channel ORA_DISK_2
  5. channel ORA_DISK_1: starting incremental datafile backupset restore
  6. channel ORA_DISK_1: specifying datafile copies to recover
  7. recovering datafile copy fno=00001 name=+DATA/prod/datafile/system.259.856179627
  8. recovering datafile copy fno=00002 name=+DATA/prod/datafile/undotbs1.260.856179763
  9. recovering datafile copy fno=00003 name=+DATA/prod/datafile/sysaux.258.856179919
  10. recovering datafile copy fno=00004 name=+DATA/prod/datafile/users.256.856180049
  11. recovering datafile copy fno=00005 name=+DATA/prod/datafile/example.257.856180003
  12. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/10.2.0/db_1/dbs/etpgghnv_1_1
  13. channel ORA_DISK_1: restored backup piece 1
  14. piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/etpgghnv_1_1 tag=TAG20140821T115438
  15. channel ORA_DISK_1: restore complete, elapsed time: 00:00:16
  16. Finished recover at 21-AUG-14

  17. Starting Control File and SPFILE Autobackup at 21-AUG-14
  18. piece handle=/arch/ctl_c-267173497-20140821-07 comment=NONE
  19. Finished Control File and SPFILE Autobackup at 21-AUG-14


四、檢視更新後的copy檔案:SCN一致

RMAN> list copy of database;
檢視copy檔案中資料檔案的SCN號,一致。



這樣在切換資料檔案到ASM switch database to copy; 後,
檢視資料檔案頭部SCN (v$datafile_header
),就會發現SCN號一致,都是1194421

【相關資料】

1、Oracle10g官方文件中相關介紹



2、11g ocp 模擬題中相關題目

Oracle 11g 1Z0-053-79:

You executed the following command:
RMAN> RECOVER COPY OF DATAFILE '/u01/app/oracle/oradata/orcl/users01.dbf';
Which statement regarding the above command is correct?

A. The '/u01/app/oracle/oradata/orcl/users01.dbf' data file is recovered from the image copy.

B. The '/u01/app/oracle/oradata/orcl/users01.dbf' data file is recovered from the last incremental backup.

C. Image copies of the '/u01/app/oracle/oradata/orcl/users01.dbf' data file are updated with all changes up to incremental backup SCN.

D. Image copies of the '/u01/app/oracle/oradata/orcl/users01.dbf' data file are recovered using the above command if data file recovery fails.

Answer: C


呂星昊
2014.10.08

文章連結:http://blog.itpub.net/29475508/viewspace-1291605/
轉載請註明出處!謝謝

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29475508/viewspace-1291605/,如需轉載,請註明出處,否則將追究法律責任。

相關文章