最近为了不影响开发库的使用,打算复制创建一个备库,定时更新,防止开发库不能使用的情况下,可以临时使用备库,不影响进度。
环境:
11.2.0.4的单实例库。
库1是源库(target),库2是备库(auxiliary)
操作过程:
1.库1执行全库备份
[Oracle@testvm002 duplicate]$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Mon Feb 1 16:57:06 2016 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: DEP (DBID=1501218369) RMAN> run{ 2> allocate channel dup type disk; 3> backup format '/home/oracle/duplicate/df_t%t_s%s_p%p' database; 4> sql 'alter system archive log current'; 5> backup format '/home/oracle/duplicate/al_t%t_s%s_p%p' archivelog all delete input; 6> release channel dup; 7> } using target database control file instead of recovery catalog allocated channel: dup channel dup: SID=24 device type=DISK Starting backup at 01-FEB-16 channel dup: starting full datafile backup set channel dup: specifying datafile(s) in backup set input datafile file number=00002 name=/u01/app/oracle/11.2.0.4/oradata/dep/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/11.2.0.4/oradata/dep/dep_tbs01.dbf input datafile file number=00001 name=/u01/app/oracle/11.2.0.4/oradata/dep/system01.dbf input datafile file number=00003 name=/u01/app/oracle/11.2.0.4/oradata/dep/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/11.2.0.4/oradata/dep/users01.dbf channel dup: starting piece 1 at 01-FEB-16 channel dup: finished piece 1 at 01-FEB-16 piece handle=/home/oracle/duplicate/df_t902681834_s10_p1 tag=TAG20160201T165714 comment=NONE channel dup: backup set complete, elapsed time: 00:00:36 channel dup: starting full datafile backup set channel dup: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel dup: starting piece 1 at 01-FEB-16 channel dup: finished piece 1 at 01-FEB-16 piece handle=/home/oracle/duplicate/df_t902681870_s11_p1 tag=TAG20160201T165714 comment=NONE channel dup: backup set complete, elapsed time: 00:00:01 Finished backup at 01-FEB-16 sql statement: alter system archive log current Starting backup at 01-FEB-16 current log archived channel dup: starting archived log backup set channel dup: specifying archived log(s) in backup set input archived log thread=1 sequence=743 RECID=13 STAMP=902681873 input archived log thread=1 sequence=744 RECID=14 STAMP=902681874 channel dup: starting piece 1 at 01-FEB-16 channel dup: finished piece 1 at 01-FEB-16 piece handle=/home/oracle/duplicate/al_t902681874_s12_p1 tag=TAG20160201T165754 comment=NONE channel dup: backup set complete, elapsed time: 00:00:01 channel dup: deleting archived log(s) archived log file name=/u01/app/oracle/11.2.0.4/fast_recovery_area/DEP/archivelog/2016_02_01/o1_mf_1_743_cby7jklq_.arc RECID=13 STAMP=902681873 archived log file name=/u01/app/oracle/11.2.0.4/fast_recovery_area/DEP/archivelog/2016_02_01/o1_mf_1_744_cby7jl4s_.arc RECID=14 STAMP=902681874 Finished backup at 01-FEB-16 released channel: dup2.库1备份控制文件
SQL> alter database backup controlfile to '/home/oracle/duplicate/control.ctl'; Database altered.3.将备份集(1)拷贝到库2相同路径下,即/home/oracle/duplicate,此时产生了三个文件:
al_t902681874_s12_p1 df_t902681834_s10_p1 df_t902681870_s11_p1