码迷,mamicode.com
首页 > 数据库 > 详细

RMAN备份backup database current controlfile plus archivelog format '/opt/oracle/admin/data_arch%U.bak' delete input

时间:2020-06-13 12:45:48      阅读:60      评论:0      收藏:0      [点我收藏+]

标签:rest   mat   time   recovery   rac   one   com   taf   number   

发现一点:只要开启了CONTROLFILE AUTOBACKUP,就算只备份一个归档日志最后一步也一定会备份控制文件和spfile(如果是pfile启动,则不会备份spfile)

整库备份的最好方法
CONFIGURE CONTROLFILE AUTOBACKUP ON;
backup database format /db/backup/data%U.bak plus archivelog format /db/backup/arch%U.bak delete input;


归档日志的备份和恢复方法
Rman>backup archivelog all;--备份所有归档日志
Rman>backup archivelog sequence 580 --备份580这个归档日志
Rman>backup archivelog sequence between 580 and 584;--备份580到584的归档日志
Rman>backup archivelog from sequence 580;--备份580开始的所有归档日志
Rman>backup archivelog from sequence 580 until sequence 584;--备份580到584的归档日志
Rman>restore archivelog all;
Rman>restore archivelog sequence 580;
Rman>restore archivelog sequence between 580 and 584;
Rman>restore archivelog from sequence 580;
Rman> restore archivelog from sequence 580 until sequence 584;





CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

backup database plus archivelog format /db/backup/data_arch%U.bak delete input;
    1、current log archived+备份归档日志+删除归档日志
    2、备份数据文件
    3、备份控制文件和spfile(如果是pfile启动,则不会备份spfile)
    4、current log archived+备份归档日志+删除归档日志

backup database archivelog all format /db/backup/data_arch%U.bak delete input;
backup database include current controlfile archivelog all format /db/backup/data_arch%U.bak delete input;
    1、备份数据文件
    2、备份归档日志+删除归档日志(如果有的话,如果删除了归档日志但是备份期间又没有产生归档日志,则不会有这一步)
    3、备库控制文件和spfile(如果是pfile启动,则不会备份spfile)

backup database current controlfile archivelog all format /db/backup/data_arch%U.bak delete input;
    1、备份数据文件
    2、备份归档日志+删除归档日志(如果有的话,如果删除了归档日志但是备份期间又没有产生归档日志,则不会有这一步)
    3、备库控制文件和spfile(如果是pfile启动,则不会备份spfile)
    4、备库控制文件

backup database current controlfile plus archivelog format /db/backup/data_arch%U.bak delete input;
    1、current log archived+备份归档日志+删除归档日志
    2、备份数据文件
    3、备份控制文件和spfile(如果是pfile启动,则不会备份spfile)
    4、备库控制文件
    5、current log archived+备份归档日志+删除归档日志



CONFIGURE CONTROLFILE AUTOBACKUP ON;

backup database plus archivelog format /db/backup/data_arch%U.bak delete input;
    1、current log archived+备份归档日志+删除归档日志
    2、备份数据文件
    3、current log archived+备份归档日志+删除归档日志
    4、备份控制文件和spfile(如果是pfile启动,则不会备份spfile)

backup database archivelog all format /db/backup/data_arch%U.bak delete input;
    1、备份数据文件
    2、备份归档日志+删除归档日志(如果有的话,如果删除了归档日志但是备份期间又没有产生归档日志,则不会有这一步)
    3、备库控制文件和spfile(如果是pfile启动,则不会备份spfile)

backup database include current controlfile archivelog all format /db/backup/data_arch%U.bak delete input;
backup database current controlfile archivelog all format /db/backup/data_arch%U.bak delete input;
    1、备份数据文件
    2、备份归档日志+删除归档日志(如果有的话,如果删除了归档日志但是备份期间又没有产生归档日志,则不会有这一步)
    3、备库控制文件
    4、备库控制文件和spfile(如果是pfile启动,则不会备份spfile)

backup database current controlfile plus archivelog format /db/backup/data_arch%U.bak delete input;
    1、current log archived+备份归档日志+删除归档日志
    2、备份数据文件;备库控制文件
    3、current log archived+备份归档日志+删除归档日志
    4、备份控制文件和spfile(如果是pfile启动,则不会备份spfile)

案例: 以backup database current controlfile plus archivelog format /opt/oracle/admin/data_arch%U.bak delete input;
##--------------------------------------------------------
  当前归档文件切换,执行备份归档日志文件
##--------------------------------------------------------
Starting backup at 30-DEC-19
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=1 STAMP=1028408641
input archived log thread=1 sequence=9 RECID=2 STAMP=1028408759
input archived log thread=1 sequence=10 RECID=3 STAMP=1028408795
input archived log thread=1 sequence=11 RECID=4 STAMP=1028408847
input archived log thread=1 sequence=12 RECID=5 STAMP=1028408894
channel ORA_DISK_1: starting piece 1 at 30-DEC-19
channel ORA_DISK_1: finished piece 1 at 30-DEC-19
piece handle=/opt/oracle/admin/data_arch02ukohhu_1_1.bak tag=TAG20191230T210814 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

channel ORA_DISK_1: deleting archived log(s)  #删除所有归档日志文件
archived log file name=/opt/oracle/flash_recovery_area/ORCL/archivelog/2019_12_30/o1_mf_1_8_h0mxg0w7_.arc RECID=1 STAMP=1028408641
archived log file name=/opt/oracle/flash_recovery_area/ORCL/archivelog/2019_12_30/o1_mf_1_9_h0mxkqoh_.arc RECID=2 STAMP=1028408759
archived log file name=/opt/oracle/flash_recovery_area/ORCL/archivelog/2019_12_30/o1_mf_1_10_h0mxlvrg_.arc RECID=3 STAMP=1028408795
archived log file name=/opt/oracle/flash_recovery_area/ORCL/archivelog/2019_12_30/o1_mf_1_11_h0mxnhbt_.arc RECID=4 STAMP=1028408847
archived log file name=/opt/oracle/flash_recovery_area/ORCL/archivelog/2019_12_30/o1_mf_1_12_h0mxoysw_.arc RECID=5 STAMP=1028408894
Finished backup at 30-DEC-19

##--------------------------------------------------------
  数据文件备份,生成一个备份片,并将备份片放入到一个备份集
##--------------------------------------------------------
Starting backup at 30-DEC-19  
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=00001 name=/opt/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/opt/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/opt/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00005 name=/opt/oracle/oradata/orcl/example01.dbf
input datafile file number=00004 name=/opt/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 30-DEC-19
channel ORA_DISK_1: finished piece 1 at 30-DEC-19
piece handle=/opt/oracle/flash_recovery_area/ORCL/backupset/2019_12_30/o1_mf_nnndf_TAG20191230T210816_h0mxp0b5_.bkp tag=TAG20191230T210816 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
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 30-DEC-19
channel ORA_DISK_1: finished piece 1 at 30-DEC-19
piece handle=/opt/oracle/flash_recovery_area/ORCL/backupset/2019_12_30/o1_mf_ncnnf_TAG20191230T210816_h0mxq4dl_.bkp tag=TAG20191230T210816 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-DEC-19


##--------------------------------------------------------
  将备份时候产生的归档日志进行备份
##--------------------------------------------------------
Starting backup at 30-DEC-19
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=13 RECID=6 STAMP=1028408933
channel ORA_DISK_1: starting piece 1 at 30-DEC-19
channel ORA_DISK_1: finished piece 1 at 30-DEC-19
piece handle=/opt/oracle/admin/data_arch05ukohj5_1_1.bak tag=TAG20191230T210853 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/opt/oracle/flash_recovery_area/ORCL/archivelog/2019_12_30/o1_mf_1_13_h0mxq5gm_.arc RECID=6 STAMP=1028408933
Finished backup at 30-DEC-19

##--------------------------------------------------------
  自动控制文件备份
##--------------------------------------------------------
Starting Control File and SPFILE Autobackup at 30-DEC-19
piece handle=/opt/oracle/flash_recovery_area/ORCL/autobackup/2019_12_30/o1_mf_s_1028408934_h0mxq6ok_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 30-DEC-19

 

RMAN备份backup database current controlfile plus archivelog format '/opt/oracle/admin/data_arch%U.bak' delete input

标签:rest   mat   time   recovery   rac   one   com   taf   number   

原文地址:https://www.cnblogs.com/vmsysjack/p/13112741.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!