我是靠谱客的博主 含糊大侠,最近开发中收集的这篇文章主要介绍【RMAN】使用增量备份更新数据库备份镜像,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

使用增量备份更新数据库备份镜像

从文件系统迁移数据文件到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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29475508/viewspace-1291605/

最后

以上就是含糊大侠为你收集整理的【RMAN】使用增量备份更新数据库备份镜像的全部内容,希望文章能够帮你解决【RMAN】使用增量备份更新数据库备份镜像所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(34)

评论列表共有 0 条评论

立即
投稿
返回
顶部