eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« Oracle10g如何释放flash_recovery_area,解决ORA-19815错误 | Blog首页 | 使用COPY的镜像文件进行基于表空间/数据文件的恢复 »

使用Oracle10g新特性简化数据库镜像COPY

当你使用RMAN执行BACKUP命令,你可以创建一个或多个备份集或者镜像拷贝。
镜像拷贝是单个数据文件、归档日志或者控制文件的额外拷贝,不以RMAN的格式存储。镜像拷贝的文件和执行操作系统级拷贝的文件一样,RMAN进行重建或者恢复操作时,可以使用镜像拷贝,当然手工操作也可以使用。

当你发出一个RESTORE命令时,缺省的RMAN恢复一个数据文件或者控制文件的镜像拷贝到原来的位置,镜像拷贝优于备份级被使用,因为使用备份级进行恢复会有额外的开销。
并且,如果你需要使用镜像拷贝恢复数据文件或者控制文件,你无需把文件COPY到原来位置,RMAN的SWITCH命令可以通知数据库使用当前位置的文件,这类似于ALTER DATABASE RENAME FILE命令的功能。
Oracle允许我们使用RMAN进行镜像COPY备份,如:

$ rman target / Recovery Manager: Release 10.1.0.2.0 - 64bit Production Copyright (c) 1995, 2004, Oracle. All rights reserved. connected to target database: EYGLE (DBID=1337390772) RMAN> run { 2> allocate channel ch1 type disk; 3> copy 4> datafile 1 to '/data5/orabak/system01.dbf', 5> current controlfile to '/data5/orabak/control01.ctl'; 6> } using target database controlfile instead of recovery catalog allocated channel: ch1 channel ch1: sid=144 devtype=DISK Starting backup at 28-MAR-05 channel ch1: starting datafile copy input datafile fno=00001 name=/opt/oracle/oradata/eygle/system01.dbf output filename=/data5/orabak/system01.dbf tag=TAG20050328T140951 recid=3 stamp=554134212 channel ch1: datafile copy complete, elapsed time: 00:00:25 channel ch1: starting datafile copy copying current controlfile output filename=/data5/orabak/control01.ctl tag=TAG20050328T140951 recid=4 stamp=554134219 channel ch1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 28-MAR-05 Starting Control File and SPFILE Autobackup at 28-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/autobackup/2005_03_28/o1_mf_s_554134221_14h7yh8n_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 28-MAR-05 released channel: ch1 RMAN>

从Oracle10g开始,Oracle允许使用单条命令"backup as copy"进行全数据库镜像拷贝备份:

RMAN> run { 2> backup as copy tag "03280501_copy" database; 3> } Starting backup at 28-MAR-05 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy input datafile fno=00009 name=/data1/oradata/systemfile/bigtbs.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_bigtbs_14h9rwv9_.dbf tag=03280501_COPY recid=12 stamp=554136129 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45 channel ORA_DISK_1: starting datafile copy input datafile fno=00001 name=/opt/oracle/oradata/eygle/system01.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_system_14h9tbms_.dbf tag=03280501_COPY recid=13 stamp=554136158 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25 channel ORA_DISK_1: starting datafile copy input datafile fno=00005 name=/data1/oradata/systemfile/eygle01.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_eygle_14h9v4bd_.dbf tag=03280501_COPY recid=14 stamp=554136175 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile fno=00006 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_test_03xv34ny_.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_test_14h9vn0z_.dbf tag=03280501_COPY recid=15 stamp=554136200 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25 channel ORA_DISK_1: starting datafile copy input datafile fno=00002 name=/opt/oracle/oradata/eygle/undotbs01.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_undotbs1_14h9wfq7_.dbf tag=03280501_COPY recid=16 stamp=554136218 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile fno=00003 name=/opt/oracle/oradata/eygle/sysaux01.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_sysaux_14h9wxfn_.dbf tag=03280501_COPY recid=17 stamp=554136231 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile fno=00011 name=/data1/oradata/systemfile/t2k01.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_t2k_14h9xf4y_.dbf tag=03280501_COPY recid=18 stamp=554136238 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile fno=00004 name=/opt/oracle/oradata/eygle/users01.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_users_14h9xjx2_.dbf tag=03280501_COPY recid=19 stamp=554136248 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile fno=00007 name=/opt/oracle/oradata/eygle/EYGLE/datafile/o1_mf_itpub_03xv5g66_.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_itpub_14h9y0pg_.dbf tag=03280501_COPY recid=20 stamp=554136263 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15 channel ORA_DISK_1: starting datafile copy input datafile fno=00010 name=/opt/oracle/oradata/eygle/dfmbrc.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_dfmbrc_14h9yjfg_.dbf tag=03280501_COPY recid=21 stamp=554136273 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile fno=00008 name=/data1/oradata/systemfile/trans01.dbf output filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_trans_14h9ymw3_.dbf tag=03280501_COPY recid=22 stamp=554136276 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 Finished backup at 28-MAR-05 Starting Control File and SPFILE Autobackup at 28-MAR-05 piece handle=/data5/flash_recovery_area/EYGLE/autobackup/2005_03_28/o1_mf_s_554136279_14h9yrlt_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 28-MAR-05 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 1 28-MAR-05 Backup Piece 1 28-MAR-05 /data5/flash_recovery_area/EYGLE/autobackup/2005_03_28/o1_mf_s_554134221_14h7yh8n_.bkp Datafile Copy 5 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_bigtbs_14h92fvo_.dbf Datafile Copy 6 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_system_14h93vn0_.dbf Datafile Copy 7 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_eygle_14h94o6v_.dbf Datafile Copy 8 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_test_14h954y9_.dbf Datafile Copy 9 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_t2k_14h9662h_.dbf Datafile Copy 10 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_dfmbrc_14h96k4r_.dbf Datafile Copy 11 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_trans_14h96nr7_.dbf Archive Log 228 28-MAR-05 /data5/flash_recovery_area/EYGLE/archivelog/2005_03_28/o1_mf_1_1752_14h0fvx9_.arc RMAN> delete obsolete; RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 using channel ORA_DISK_1 Deleting the following obsolete backups and copies: Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 1 28-MAR-05 Backup Piece 1 28-MAR-05 /data5/flash_recovery_area/EYGLE/autobackup/2005_03_28/o1_mf_s_554134221_14h7yh8n_.bkp Datafile Copy 5 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_bigtbs_14h92fvo_.dbf Datafile Copy 6 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_system_14h93vn0_.dbf Datafile Copy 7 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_eygle_14h94o6v_.dbf Datafile Copy 8 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_test_14h954y9_.dbf Datafile Copy 9 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_t2k_14h9662h_.dbf Datafile Copy 10 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_dfmbrc_14h96k4r_.dbf Datafile Copy 11 28-MAR-05 /data5/flash_recovery_area/EYGLE/datafile/o1_mf_trans_14h96nr7_.dbf Archive Log 228 28-MAR-05 /data5/flash_recovery_area/EYGLE/archivelog/2005_03_28/o1_mf_1_1752_14h0fvx9_.arc Do you really want to delete the above objects (enter YES or NO)? YES deleted backup piece backup piece handle=/data5/flash_recovery_area/EYGLE/autobackup/2005_03_28/o1_mf_s_554134221_14h7yh8n_.bkp recid=1 stamp=554134223 deleted datafile copy datafile copy filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_bigtbs_14h92fvo_.dbf recid=5 stamp=554135410 deleted datafile copy datafile copy filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_system_14h93vn0_.dbf recid=6 stamp=554135438 deleted datafile copy datafile copy filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_eygle_14h94o6v_.dbf recid=7 stamp=554135455 deleted datafile copy datafile copy filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_test_14h954y9_.dbf recid=8 stamp=554135480 deleted datafile copy datafile copy filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_t2k_14h9662h_.dbf recid=9 stamp=554135495 deleted datafile copy datafile copy filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_dfmbrc_14h96k4r_.dbf recid=10 stamp=554135506 deleted datafile copy datafile copy filename=/data5/flash_recovery_area/EYGLE/datafile/o1_mf_trans_14h96nr7_.dbf recid=11 stamp=554135509 deleted archive log archive log filename=/data5/flash_recovery_area/EYGLE/archivelog/2005_03_28/o1_mf_1_1752_14h0fvx9_.arc recid=228 stamp=554126524 Deleted 9 objects RMAN>

这极大的简化了镜像COPY命令的操作。


历史上的今天...
    >> 2013-03-28文章:
    >> 2012-03-28文章:
           JRE问题之未解决 - 备案
    >> 2011-03-28文章:
    >> 2009-03-28文章:
    >> 2008-03-28文章:
    >> 2006-03-28文章:
           Oracle的前尘旧版

无觅

By eygle on 2005-03-28 15:11 | Comments (0) | Backup&Recovery | 221 |


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com