使用RMAN备份时什么时候才会自动备份控制文件

Target DB / RMAN Client: 11.2.0.1.0


1. 当CONFIGURE CONTROLFILE AUTOBACKUP OFF;时,仅备份数据文件1(system01.dbf)时会自动备份控制文件;

2. 当CONFIGURE CONTROLFILE AUTOBACKUP ON;时,备份任意文件(数据文件/归档日志)都会自动备份控制文件。


RMAN> show all;


RMAN configuration parameters for database with db_unique_name T11A are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\ORA11G\ORASOFT\DATABASE\SNCFT11A.ORA'; # default

RMAN> backup datafile 1;

Starting backup at 05-JUN-12
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=D:\ORA11G\ORADATA\T11A\SYSTEM01.DBF
channel ORA_DISK_1: starting piece 1 at 05-JUN-12
channel ORA_DISK_1: finished piece 1 at 05-JUN-12
piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151702_7WVDMHGW_.BKP tag=TAG20120605T151702 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 05-JUN-12
channel ORA_DISK_1: finished piece 1 at 05-JUN-12
piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NCSNF_TAG20120605T151702_7WVDN1PN_.BKP tag=TAG20120605T151702 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 05-JUN-12

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    186.25M    DISK        00:00:12     05-JUN-12
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20120605T151702
        Piece Name: D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151702_7WVDMHGW_.BKP
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 664502     05-JUN-12 D:\ORA11G\ORADATA\T11A\SYSTEM01.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    9.36M      DISK        00:00:04     05-JUN-12
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20120605T151702
        Piece Name: D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NCSNF_TAG20120605T151702_7WVDN1PN_.BKP
  SPFILE Included: Modification time: 05-JUN-12
  SPFILE db_unique_name: T11A
  Control File Included: Ckp SCN: 664507       Ckp time: 05-JUN-12

RMAN> delete backup;

using channel ORA_DISK_1

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
2       2       1   1   AVAILABLE   DISK        D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151702_7WVDMHGW_.BKP
3       3       1   1   AVAILABLE   DISK        D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NCSNF_TAG20120605T151702_7WVDN1PN_.BKP

Do you really want to delete the above objects (enter YES or NO)? y
deleted backup piece
backup piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151702_7WVDMHGW_.BKP RECID=2 STAMP=785171823
deleted backup piece
backup piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NCSNF_TAG20120605T151702_7WVDN1PN_.BKP RECID=3 STAMP=785171841
Deleted 2 objects


RMAN> backup datafile 2;

Starting backup at 05-JUN-12
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=00002 name=D:\ORA11G\ORADATA\T11A\SYSAUX01.DBF
channel ORA_DISK_1: starting piece 1 at 05-JUN-12
channel ORA_DISK_1: finished piece 1 at 05-JUN-12
piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151753_7WVDO1TY_.BKP tag=TAG20120605T151753 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 05-JUN-12

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4       Full    132.41M    DISK        00:00:08     05-JUN-12
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20120605T151753
        Piece Name: D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151753_7WVDO1TY_.BKP
  List of Datafiles in backup set 4
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 664556     05-JUN-12 D:\ORA11G\ORADATA\T11A\SYSAUX01.DBF

RMAN> delete backup;

using channel ORA_DISK_1

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
4       4       1   1   AVAILABLE   DISK        D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151753_7WVDO1TY_.BKP

Do you really want to delete the above objects (enter YES or NO)? y
deleted backup piece
backup piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151753_7WVDO1TY_.BKP RECID=4 STAMP=785171873
Deleted 1 objects


RMAN> show all;

RMAN configuration parameters for database with db_unique_name T11A are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\ORA11G\ORASOFT\DATABASE\SNCFT11A.ORA'; # default

RMAN> configure controlfile autobackup on;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> show all;

RMAN configuration parameters for database with db_unique_name T11A are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\ORA11G\ORASOFT\DATABASE\SNCFT11A.ORA'; # default

RMAN> backup datafile 2;

Starting backup at 05-JUN-12
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=00002 name=D:\ORA11G\ORADATA\T11A\SYSAUX01.DBF
channel ORA_DISK_1: starting piece 1 at 05-JUN-12
channel ORA_DISK_1: finished piece 1 at 05-JUN-12
piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151849_7WVDPSDG_.BKP tag=TAG20120605T151849 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 05-JUN-12

Starting Control File and SPFILE Autobackup at 05-JUN-12
piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\AUTOBACKUP\2012_06_05\O1_MF_S_785171944_7WVDQ9NH_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 05-JUN-12

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    132.41M    DISK        00:00:08     05-JUN-12
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20120605T151849
        Piece Name: D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151849_7WVDPSDG_.BKP
  List of Datafiles in backup set 5
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 664637     05-JUN-12 D:\ORA11G\ORADATA\T11A\SYSAUX01.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    9.36M      DISK        00:00:02     05-JUN-12
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20120605T151904
        Piece Name: D:\ORA11G\FLASH_RECOVERY_AREA\T11A\AUTOBACKUP\2012_06_05\O1_MF_S_785171944_7WVDQ9NH_.BKP
  SPFILE Included: Modification time: 05-JUN-12
  SPFILE db_unique_name: T11A
  Control File Included: Ckp SCN: 664648       Ckp time: 05-JUN-12


RMAN> backup archivelog all;

Starting backup at 05-JUN-12
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=142 device type=DISK
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=38 RECID=12 STAMP=785172490
channel ORA_DISK_1: starting piece 1 at 05-JUN-12
channel ORA_DISK_1: finished piece 1 at 05-JUN-12
piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_ANNNN_TAG20120605T152812_7WVF8F0T_.BKP tag=TAG20120605T152812 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 05-JUN-12

Starting Control File and SPFILE Autobackup at 05-JUN-12
piece handle=D:\ORA11G\FLASH_RECOVERY_AREA\T11A\AUTOBACKUP\2012_06_05\O1_MF_S_785172496_7WVF8KLR_.BKP comment=NONE
Finished Control File and SPFILE Autobackup at 05-JUN-12

RMAN>



REF
1. Backing Up Control Files with RMAN
http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmbckba.htm#i1009642


You can back up the control file when the database is mounted or open. RMAN uses a snapshot control file to ensure a read-consistent version. If the CONFIGURE CONTROLFILE AUTOBACKUP command is set to ON (by default it is OFF), then RMAN automatically backs up the control file and server parameter file after every backup and after database structural changes. 


If the autobackup feature is not set, then you must manually back up the control file in one of the following ways:

Run BACKUP CURRENT CONTROLFILE .
Include a backup of the control file within any backup by using the INCLUDE CURRENT CONTROLFILE option of the BACKUP command.
Back up data file 1, because RMAN automatically includes the control file and server parameter file in backups of data file 1.


Note:
If the control file block size is not equal to the block size for data file 1, then the control file cannot be written into the same backup set as the data file. RMAN writes the control file into a backup set by itself if the block size is different. The V$CONTROLFILE.BLOCK_SIZE column indicates the control file block size, whereas the DB_BLOCK_SIZE initialization parameter indicates the block size of data file 1.


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值