概述
从文件系统迁移数据文件到ASM磁盘组时,可以使用RMAN对数据库进行热备份为镜像文件。如果数据量大,热备过程持续时间长,热备过程中事务比较繁忙,可以在热备结束后再做一次增量备份,来更新热备出来的镜像文件。
【实验环境】
操作系统:AIX 5.3
数据库:Oracle 10.2.0
【实验过程】
一、0级增量热备:
点击(此处)折叠或打开
- run {
- sql 'alter system archive log current';
- allocate channel dev1 type disk;
- backup as copy incremental level 0 database format '+DATA' TAG 'lxh_asm_migration';
- sql 'alter system archive log current';
- }
- RMAN>
- sql statement: alter system archive log current
- released channel: ORA_DISK_1
- released channel: ORA_DISK_2
- allocated channel: dev1
- channel dev1: sid=144 devtype=DISK
- Starting backup at 21-AUG-14
- channel dev1: starting datafile copy
- input datafile fno=00001 name=/u01/app/oracle/oradata/prod/system01.dbf
- output filename=+DATA/prod/datafile/system.259.856179627 tag=LXH_ASM_MIGRATION recid=47 stamp=856179756
- channel dev1: datafile copy complete, elapsed time: 00:02:15
- channel dev1: starting datafile copy
- input datafile fno=00002 name=/u01/app/oracle/oradata/prod/undotbs01.dbf
- output filename=+DATA/prod/datafile/undotbs1.260.856179763 tag=LXH_ASM_MIGRATION recid=48 stamp=856179907
- channel dev1: datafile copy complete, elapsed time: 00:02:35
- channel dev1: starting datafile copy
- input datafile fno=00003 name=/u01/app/oracle/oradata/prod/sysaux01.dbf
- output filename=+DATA/prod/datafile/sysaux.258.856179919 tag=LXH_ASM_MIGRATION recid=49 stamp=856180002
- channel dev1: datafile copy complete, elapsed time: 00:01:25
- channel dev1: starting datafile copy
- input datafile fno=00005 name=/u01/app/oracle/oradata/prod/example01.dbf
- output filename=+DATA/prod/datafile/example.257.856180003 tag=LXH_ASM_MIGRATION recid=50 stamp=856180045
- channel dev1: datafile copy complete, elapsed time: 00:00:45
- channel dev1: starting datafile copy
- input datafile fno=00004 name=/u01/app/oracle/oradata/prod/users01.dbf
- output filename=+DATA/prod/datafile/users.256.856180049 tag=LXH_ASM_MIGRATION recid=51 stamp=856180051
- channel dev1: datafile copy complete, elapsed time: 00:00:03
- Finished backup at 21-AUG-14
-
- Starting Control File and SPFILE Autobackup at 21-AUG-14
- piece handle=/arch/ctl_c-267173497-20140821-04 comment=NONE
- Finished Control File and SPFILE Autobackup at 21-AUG-14
-
- sql statement: alter system archive log current
- released channel: dev1
二、1级增量热备:SCN不一致
点击(此处)折叠或打开
- run {
- sql 'alter system archive log current';
- allocate channel dev1 type disk;
- backup incremental level 1 for recover of copy with tag 'lxh_asm_migration' database;
- sql 'alter system archive log current';
- }
点击(此处)折叠或打开
- sql statement: alter system archive log current
-
- allocated channel: dev1
- channel dev1: sid=144 devtype=DISK
-
- Starting backup at 21-AUG-14
- channel dev1: starting compressed incremental level 1 datafile backupset
- channel dev1: specifying datafile(s) in backupset
- input datafile fno=00001 name=/u01/app/oracle/oradata/prod/system01.dbf
- input datafile fno=00002 name=/u01/app/oracle/oradata/prod/undotbs01.dbf
- input datafile fno=00003 name=/u01/app/oracle/oradata/prod/sysaux01.dbf
- input datafile fno=00005 name=/u01/app/oracle/oradata/prod/example01.dbf
- input datafile fno=00004 name=/u01/app/oracle/oradata/prod/users01.dbf
- channel dev1: starting piece 1 at 21-AUG-14
- channel dev1: finished piece 1 at 21-AUG-14
- piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/etpgghnv_1_1 tag=TAG20140821T115438 comment=NONE
- channel dev1: backup set complete, elapsed time: 00:00:03
- Finished backup at 21-AUG-14
-
- Starting Control File and SPFILE Autobackup at 21-AUG-14
- piece handle=/arch/ctl_c-267173497-20140821-05 comment=NONE
- Finished Control File and SPFILE Autobackup at 21-AUG-14
-
- sql statement: alter system archive log current
- released channel: dev1
查看copy文件中数据文件的SCN号,不一致。
三、refresh copy:SCN一致
点击(此处)折叠或打开
- RMAN> recover copy of database with tag 'lxh_asm_migration';
- Starting recover at 21-AUG-14
- using channel ORA_DISK_1
- using channel ORA_DISK_2
- channel ORA_DISK_1: starting incremental datafile backupset restore
- channel ORA_DISK_1: specifying datafile copies to recover
- recovering datafile copy fno=00001 name=+DATA/prod/datafile/system.259.856179627
- recovering datafile copy fno=00002 name=+DATA/prod/datafile/undotbs1.260.856179763
- recovering datafile copy fno=00003 name=+DATA/prod/datafile/sysaux.258.856179919
- recovering datafile copy fno=00004 name=+DATA/prod/datafile/users.256.856180049
- recovering datafile copy fno=00005 name=+DATA/prod/datafile/example.257.856180003
- channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/10.2.0/db_1/dbs/etpgghnv_1_1
- channel ORA_DISK_1: restored backup piece 1
- piece handle=/u01/app/oracle/product/10.2.0/db_1/dbs/etpgghnv_1_1 tag=TAG20140821T115438
- channel ORA_DISK_1: restore complete, elapsed time: 00:00:16
- Finished recover at 21-AUG-14
-
- Starting Control File and SPFILE Autobackup at 21-AUG-14
- piece handle=/arch/ctl_c-267173497-20140821-07 comment=NONE
- 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】使用增量备份更新数据库备份镜像所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复