Oracle Rman技术总结(一)——备份


一、Rman 备份
Rman备份形式:镜像复制和备份集。 镜像复制: 镜像复制实际上就是将数据文件、控制文件或者归档文件的复制,与用户通过操作系统命令建立的方式一样,只不过rman利用数据库形式进行复制,而用户通过操作系 统命令。 备份集: 通过rman创建的逻辑备份对象。一个备份集中可以包含多个数据文件、控制文件、或归档文件。备份集在物理上是由多个备份片段组成,每个备份片段式一个操作系统文件
如果备份需要指定备份路径,请在备份命令后面跟上 format "备份路径" 参数。例如:backup database format "备份路径"

1、对数据库全备份
全备份命令:backup database
如果不指定备份路径,那么就存放在默认路径下。指定路径全备份命令:backup database format "备份路径"

 
  

RMAN> backup database;

Starting backup at 26-MAY-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=17 device type=DISK

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00001 name=/home/oracle/app/oracle/oradata/orcl/system01.dbf

input datafile file number=00002 name=/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf

input datafile file number=00010 name=/home/oracle/tpfda.dbf

input datafile file number=00008 name=/home/oracle/fla.dbf

input datafile file number=00011 name=/home/oracle/undo_fda.dbf

input datafile file number=00005 name=/home/oracle/app/oracle/oradata/orcl/example01.dbf

input datafile file number=00007 name=/home/oracle/dbf001.dbf

input datafile file number=00003 name=/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf

input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf

input datafile file number=00009 name=/home/oracle/undosmall.dbf

input datafile file number=00012 name=/home/oracle/undo_fda01.dbf

channel ORA_DISK_1: starting piece 1 at 26-MAY-13

channel ORA_DISK_1: finished piece 1 at 26-MAY-13

piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T221123_8t4gso9f_.bkp tag=TAG20130526T221123 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:02:51

Finished backup at 26-MAY-13


查看全备份命令:list backup of database
 
   

RMAN> list backup of database; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 3 Full 1.08G DISK 00:04:35 26-MAY-13 BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20130526T220643 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T220643_8t4gjwhc_.bkp List of Datafiles in backup set 3 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 2005135 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/system01.dbf 2 Full 2005135 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf 3 Full 2005135 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf 4 Full 2005135 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf 5 Full 2005135 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/example01.dbf 7 Full 2005135 26-MAY-13 /home/oracle/dbf001.dbf 8 Full 2005135 26-MAY-13 /home/oracle/fla.dbf 9 Full 2005135 26-MAY-13 /home/oracle/undosmall.dbf 10 Full 2005135 26-MAY-13 /home/oracle/tpfda.dbf 11 Full 2005135 26-MAY-13 /home/oracle/undo_fda.dbf 12 Full 2005135 26-MAY-13 /home/oracle/undo_fda01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 5 Full 1.08G DISK 00:02:43 26-MAY-13 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20130526T221123 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T221123_8t4gso9f_.bkp List of Datafiles in backup set 5 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 2005300 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/system01.dbf 2 Full 2005300 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf 3 Full 2005300 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf 4 Full 2005300 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf 5 Full 2005300 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/example01.dbf 7 Full 2005300 26-MAY-13 /home/oracle/dbf001.dbf 8 Full 2005300 26-MAY-13 /home/oracle/fla.dbf 9 Full 2005300 26-MAY-13 /home/oracle/undosmall.dbf 10 Full 2005300 26-MAY-13 /home/oracle/tpfda.dbf 11 Full 2005300 26-MAY-13 /home/oracle/undo_fda.dbf 12 Full 2005300 26-MAY-13 /home/oracle/undo_fda01.dbf


2、备份表空间
备份表空间命令:backup tablespace 表空间名
 
  

RMAN> backup tablespace users; Starting backup at 26-MAY-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T222935_8t4hvqfo_.bkp tag=TAG20130526T222935 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 26-MAY-13 Starting Control File and SPFILE Autobackup at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816474578_8t4hvvcb_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 26-MAY-13l ORA_DISK_1: starting piece 1 at 26-MAY-13

查看表空间备份情况:list backup of tablepsace 表空间名称
 
     

RMAN> list backup of tablespace users; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 3 Full 1.08G DISK 00:04:35 26-MAY-13 BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20130526T220643 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T220643_8t4gjwhc_.bkp List of Datafiles in backup set 3 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2005135 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 5 Full 1.08G DISK 00:02:43 26-MAY-13 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20130526T221123 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T221123_8t4gso9f_.bkp List of Datafiles in backup set 5 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2005300 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 7 Full 6.52M DISK 00:00:02 26-MAY-13 BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20130526T222935 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T222935_8t4hvqfo_.bkp List of Datafiles in backup set 7 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2005916 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf


3、备份数据文件
备份数据文件命令:backup datafile 数据文件号 即对应dba_data_files表中的file_id
 
  

查询需要备份的数据文件

SQL> select file_name,file_id,tablespace_name from dba_data_files; FILE_NAME FILE_ID TABLESPACE_NAME ------------------------------------------------------------ ---------- ------------------------------ /home/oracle/dbf001.dbf 7 TS001 /home/oracle/app/oracle/oradata/orcl/example01.dbf 5 EXAMPLE /home/oracle/app/oracle/oradata/orcl/users01.dbf 4 USERS /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf 3 UNDOTBS1 /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf 2 SYSAUX /home/oracle/app/oracle/oradata/orcl/system01.dbf 1 SYSTEM /home/oracle/fla.dbf 8 FLADB /home/oracle/undosmall.dbf 9 UNDO_SMALL /home/oracle/tpfda.dbf 10 TPFDA /home/oracle/undo_fda.dbf 11 TPUFDA /home/oracle/undo_fda01.dbf 12 UNDO_TPFDA

备份数据文件

RMAN> backup datafile 4; Starting backup at 26-MAY-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T223905_8t4jfkx8_.bkp tag=TAG20130526T223905 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 26-MAY-13 Starting Control File and SPFILE Autobackup at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816475147_8t4jfmkl_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 26-MAY-13


查看备份数据文件命令:list backup of datafile 数据文件号 即对应dba_data_files表中的file_id
 
   

RMAN> list backup of datafile 4; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 3 Full 1.08G DISK 00:04:35 26-MAY-13 BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20130526T220643 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T220643_8t4gjwhc_.bkp List of Datafiles in backup set 3 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2005135 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 5 Full 1.08G DISK 00:02:43 26-MAY-13 BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20130526T221123 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T221123_8t4gso9f_.bkp List of Datafiles in backup set 5 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2005300 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 7 Full 6.52M DISK 00:00:02 26-MAY-13 BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20130526T222935 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T222935_8t4hvqfo_.bkp List of Datafiles in backup set 7 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2005916 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 9 Full 6.52M DISK 00:00:01 26-MAY-13 BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20130526T223848 Piece Name: /home/oracle/u% List of Datafiles in backup set 9 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2006262 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 11 Full 6.52M DISK 00:00:01 26-MAY-13 BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20130526T223905 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T223905_8t4jfkx8_.bkp List of Datafiles in backup set 11 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 4 Full 2006289 26-MAY-13 /home/oracle/app/oracle/oradata/orcl/users01.dbf



4、备份控制文件
自动备份控制文件命令:configure controlfile autobackup on
当启用自动备份控制文件功能,那么对rman做任何备份同时也会对控制文件进行自动备份
 
   

RMAN> configure controlfile autobackup on; old RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored

手动备份控制文件命令:backup current controlfile
 
   

RMAN> backup current controlfile; Starting backup at 26-MAY-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_ncnnf_TAG20130526T224954_8t4k1vgf_.bkp tag=TAG20130526T224954 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 26-MAY-13 Starting Control File and SPFILE Autobackup at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816475796_8t4k1x26_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 26-MAY-13

另一种方法手动备份控制文件:执行backup时同时指定include current controlfile参数
 
   

RMAN> backup tablespace users include current controlfile; Starting backup at 26-MAY-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T225406_8t4k9pww_.bkp tag=TAG20130526T225406 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_ncnnf_TAG20130526T225406_8t4k9s37_.bkp tag=TAG20130526T225406 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 26-MAY-13 Starting Control File and SPFILE Autobackup at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816476050_8t4k9tqv_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 26-MAY-13

查看备份控制文件信息命令:list backup of controlfile
 
    

RMAN> list backup of controlfile; List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 1 Full 9.64M DISK 00:00:04 26-MAY-13 BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20130526T214125 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_ncnnf_TAG20130526T214125_8t4f1jnb_.bkp Control File Included: Ckp SCN: 2004209 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 2 Full 9.67M DISK 00:00:01 26-MAY-13 BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20130526T214132 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816471692_8t4f1nlx_.bkp Control File Included: Ckp SCN: 2004217 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 4 Full 9.67M DISK 00:00:11 26-MAY-13 BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20130526T221243 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816473563_8t4gwcyp_.bkp Control File Included: Ckp SCN: 2005354 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 6 Full 9.67M DISK 00:00:02 26-MAY-13 BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20130526T221415 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816473655_8t4gz0nf_.bkp Control File Included: Ckp SCN: 2005424 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 8 Full 9.67M DISK 00:00:01 26-MAY-13 BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20130526T222938 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816474578_8t4hvvcb_.bkp Control File Included: Ckp SCN: 2005923 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 10 Full 9.67M DISK 00:00:01 26-MAY-13 BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20130526T223849 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816475129_8t4jf2bc_.bkp Control File Included: Ckp SCN: 2006268 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 12 Full 9.67M DISK 00:00:00 26-MAY-13 BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20130526T223907 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816475147_8t4jfmkl_.bkp Control File Included: Ckp SCN: 2006295 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 13 Full 9.64M DISK 00:00:02 26-MAY-13 BP Key: 13 Status: AVAILABLE Compressed: NO Tag: TAG20130526T224954 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_ncnnf_TAG20130526T224954_8t4k1vgf_.bkp Control File Included: Ckp SCN: 2006684 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 14 Full 9.67M DISK 00:00:01 26-MAY-13 BP Key: 14 Status: AVAILABLE Compressed: NO Tag: TAG20130526T224956 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816475796_8t4k1x26_.bkp Control File Included: Ckp SCN: 2006690 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 16 Full 9.64M DISK 00:00:01 26-MAY-13 BP Key: 16 Status: AVAILABLE Compressed: NO Tag: TAG20130526T225406 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_ncnnf_TAG20130526T225406_8t4k9s37_.bkp Control File Included: Ckp SCN: 2006855 Ckp time: 26-MAY-13 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 17 Full 9.67M DISK 00:00:01 26-MAY-13 BP Key: 17 Status: AVAILABLE Compressed: NO Tag: TAG20130526T225410 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816476050_8t4k9tqv_.bkp Control File Included: Ckp SCN: 2006862 Ckp time: 26-MAY-13


5、备份归档日志文件
归档日志对于数据库介质恢复相当关键,归档日志文件能够确保我们将数据库恢复到备份之前的任意时刻。
备份归档日志命令:backup archivelog all
 
    

RMAN> backup archivelog all; Starting backup at 26-MAY-13 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=20 RECID=2 STAMP=816060744 input archived log thread=1 sequence=21 RECID=3 STAMP=816060744 input archived log thread=1 sequence=22 RECID=1 STAMP=816060744 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230126_8t4kqh0j_.bkp tag=TAG20130526T230126 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=4 STAMP=816061734 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230126_8t4kqj60_.bkp tag=TAG20130526T230126 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=6 STAMP=816122522 input archived log thread=1 sequence=2 RECID=7 STAMP=816122522 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230126_8t4kqkr3_.bkp tag=TAG20130526T230126 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=8 STAMP=816122765 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230126_8t4kqryq_.bkp tag=TAG20130526T230126 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=9 STAMP=816123309 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230126_8t4kqt4s_.bkp tag=TAG20130526T230126 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=10 STAMP=816218527 input archived log thread=1 sequence=2 RECID=11 STAMP=816399662 input archived log thread=1 sequence=3 RECID=12 STAMP=816400723 input archived log thread=1 sequence=4 RECID=13 STAMP=816468161 input archived log thread=1 sequence=5 RECID=14 STAMP=816468200 input archived log thread=1 sequence=6 RECID=15 STAMP=816476484 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230126_8t4kqvcg_.bkp tag=TAG20130526T230126 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25 Finished backup at 26-MAY-13 Starting Control File and SPFILE Autobackup at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816476524_8t4krnxz_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 26-MAY-13

另一种备份归档日志方法:在backup过程中 利用plus archivelog 参数备份
 
    

RMAN> backup datafile 4 plus archivelog; Starting backup at 26-MAY-13 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=20 RECID=2 STAMP=816060744 input archived log thread=1 sequence=21 RECID=3 STAMP=816060744 input archived log thread=1 sequence=22 RECID=1 STAMP=816060744 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230529_8t4kz20g_.bkp tag=TAG20130526T230529 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=4 STAMP=816061734 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230529_8t4kz35g_.bkp tag=TAG20130526T230529 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=6 STAMP=816122522 input archived log thread=1 sequence=2 RECID=7 STAMP=816122522 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230529_8t4kz4c4_.bkp tag=TAG20130526T230529 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=8 STAMP=816122765 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230529_8t4kz5m9_.bkp tag=TAG20130526T230529 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=9 STAMP=816123309 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230529_8t4kz6tc_.bkp tag=TAG20130526T230529 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=10 STAMP=816218527 input archived log thread=1 sequence=2 RECID=11 STAMP=816399662 input archived log thread=1 sequence=3 RECID=12 STAMP=816400723 input archived log thread=1 sequence=4 RECID=13 STAMP=816468161 input archived log thread=1 sequence=5 RECID=14 STAMP=816468200 input archived log thread=1 sequence=6 RECID=15 STAMP=816476484 input archived log thread=1 sequence=7 RECID=16 STAMP=816476729 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230529_8t4kz82j_.bkp tag=TAG20130526T230529 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 Finished backup at 26-MAY-13 Starting backup at 26-MAY-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/home/oracle/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_nnndf_TAG20130526T230543_8t4kzhy9_.bkp tag=TAG20130526T230543 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 26-MAY-13 Starting backup at 26-MAY-13 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=8 RECID=17 STAMP=816476746 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230546_8t4kzm7n_.bkp tag=TAG20130526T230546 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 26-MAY-13 Starting Control File and SPFILE Autobackup at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816476748_8t4kzo8b_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 26-MAY-13

查看备份归档日志信息:list backup of archivelog all
 
    

RMAN> list backup of archivelog all; List of Backup Sets =================== BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 23 163.62M DISK 00:00:20 26-MAY-13 BP Key: 23 Status: AVAILABLE Compressed: NO Tag: TAG20130526T230126 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T2301268t4kqvcg_.bkp List of Archived Logs in backup set 23 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 1 1817763 22-MAY-13 1916388 23-MAY-13 1 2 1916388 23-MAY-13 1966467 26-MAY-13 1 3 1966467 26-MAY-13 1969822 26-MAY-13 1 4 1969822 26-MAY-13 1994255 26-MAY-13 1 5 1994255 26-MAY-13 1998995 26-MAY-13 1 6 1998995 26-MAY-13 2007069 26-MAY-13 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 30 163.75M DISK 00:00:07 26-MAY-13 BP Key: 30 Status: AVAILABLE Compressed: NO Tag: TAG20130526T230529 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T2305298t4kz82j_.bkp List of Archived Logs in backup set 30 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 1 1817763 22-MAY-13 1916388 23-MAY-13 1 2 1916388 23-MAY-13 1966467 26-MAY-13 1 3 1966467 26-MAY-13 1969822 26-MAY-13 1 4 1969822 26-MAY-13 1994255 26-MAY-13 1 5 1994255 26-MAY-13 1998995 26-MAY-13 1 6 1998995 26-MAY-13 2007069 26-MAY-13 1 7 2007069 26-MAY-13 2007231 26-MAY-13 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 32 2.50K DISK 00:00:00 26-MAY-13 BP Key: 32 Status: AVAILABLE Compressed: NO Tag: TAG20130526T230546 Piece Name: /home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T2305468t4kzm7n_.bkp List of Archived Logs in backup set 32 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 8 2007231 26-MAY-13 2007247 26-MAY-13

在备份归档日志时同时删除归当前档日志命令,在backup 后面delete all input 参数。例如 RMAN> backup datafile 4 plus archivelog delete all input; 例如2:RMAN >backup archivelog all delete all input;
 
    

RMAN> backup archivelog all delete all input; Starting backup at 26-MAY-13 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=1 RECID=10 STAMP=816218527 input archived log thread=1 sequence=2 RECID=11 STAMP=816399662 input archived log thread=1 sequence=3 RECID=12 STAMP=816400723 input archived log thread=1 sequence=4 RECID=13 STAMP=816468161 input archived log thread=1 sequence=5 RECID=14 STAMP=816468200 input archived log thread=1 sequence=6 RECID=15 STAMP=816476484 input archived log thread=1 sequence=7 RECID=16 STAMP=816476729 input archived log thread=1 sequence=8 RECID=17 STAMP=816476746 input archived log thread=1 sequence=9 RECID=18 STAMP=816476978 channel ORA_DISK_1: starting piece 1 at 26-MAY-13 channel ORA_DISK_1: finished piece 1 at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/backupset/2013_05_26/o1_mf_annnn_TAG20130526T230938_8t4l6v4r_.bkp tag=TAG20130526T230938 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 channel ORA_DISK_1: deleting archived log(s) archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_23/o1_mf_1_1_8swot3xc_.arc RECID=10 STAMP=816218527 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_2_8t26po7r_.arc RECID=11 STAMP=816399662 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_3_8t27qs0s_.arc RECID=12 STAMP=816400723 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_4_8t49m724_.arc RECID=13 STAMP=816468161 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_5_8t49ng04_.arc RECID=14 STAMP=816468200 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_6_8t4kq9td_.arc RECID=15 STAMP=816476484 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_7_8t4kz1h6_.arc RECID=16 STAMP=816476729 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_8_8t4kzlc0_.arc RECID=17 STAMP=816476746 archived log file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/archivelog/2013_05_26/o1_mf_1_9_8t4l6tq4_.arc RECID=18 STAMP=816476978 Finished backup at 26-MAY-13 Starting Control File and SPFILE Autobackup at 26-MAY-13 piece handle=/home/oracle/app/oracle/flash_recovery_area/ORCL/autobackup/2013_05_26/o1_mf_s_816476988_8t4l762d_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 26-MAY-13



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值