您的位置:首页 > 其它

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

2012-06-05 15:28 274 查看
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: ***AILABLE 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: ***AILABLE 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 ***AILABLE DISK D:\ORA11G\FLASH_RECOVERY_AREA\T11A\BACKUPSET\2012_06_05\O1_MF_NNNDF_TAG20120605T151702_7WVDMHGW_.BKP
3 3 1 1 ***AILABLE 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: ***AILABLE 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 ***AILABLE 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: ***AILABLE 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: ***AILABLE 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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: