以10.2为例,官方文档如此说:
http://docs.oracle.com/cd/B19306_01/backup.102/b14191/rcmconc1.htm
The RMAN behavior when the BACKUP
command includes datafile 1
depends on the CONFIGURE
CONTROLFILE
AUTOBACKUP
setting.
If control file autobackups are ON and the backup includes datafile 1, RMAN writes the control file and SPFILE to a separate autobackup backup set.
If control file autobackups are OFF and the backup includes datafile 1, then RMAN includes the current control file and SPFILE in the same backup set as the datafiles.
这是比较奇怪的。作试验进行初步验证:
上述内容是10.2的官方文档,而我用的测试环境是11.2:
RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORCL 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 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
RMAN>
进行备份:
RMAN> backup database;
Starting backup at 29-MAR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 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=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-MAR-14
channel ORA_DISK_1: finished piece 1 at 29-MAR-14
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_03_29/o1_mf_nnndf_TAG20140329T201841_9mfgk1vs_.bkp tag=TAG20140329T201841 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:03: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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 29-MAR-14
channel ORA_DISK_1: finished piece 1 at 29-MAR-14
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_03_29/o1_mf_ncsnf_TAG20140329T201841_9mfgqt2s_.bkp tag=TAG20140329T201841 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 29-MAR-14
RMAN>
可以注意到上面有一句话:
including current control file in backup set
以及:
including current SPFILE in backup set
参考:http://www.cnblogs.com/killkill/archive/2011/02/23/1962553.html
检查:
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 1.02G DISK 00:03:33 29-MAR-14
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20140329T201841
Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_03_29/o1_mf_nnndf_TAG20140329T201841_9mfgk1vs_.bkp
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 996503 29-MAR-14 /u01/app/oracle/oradata/orcl/system01.dbf
2 Full 996503 29-MAR-14 /u01/app/oracle/oradata/orcl/sysaux01.dbf
3 Full 996503 29-MAR-14 /u01/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 996503 29-MAR-14 /u01/app/oracle/oradata/orcl/users01.dbf
5 Full 996503 29-MAR-14 /u01/app/oracle/oradata/orcl/example01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 9.36M DISK 00:00:02 29-MAR-14
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20140329T201841
Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_03_29/o1_mf_ncsnf_TAG20140329T201841_9mfgqt2s_.bkp
SPFILE Included: Modification time: 29-MAR-14
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 996503 Ckp time: 29-MAR-14
RMAN>
[root@localhost 2014_03_29]# ls -lrt *.bkp
-rw-r----- 1 oracle oinstall 1097375744 Mar 29 20:21 o1_mf_nnndf_TAG20140329T201841_9mfgk1vs_.bkp
-rw-r----- 1 oracle oinstall 9830400 Mar 29 20:22 o1_mf_ncsnf_TAG20140329T201841_9mfgqt2s_.bkp
[root@localhost 2014_03_29]#
这里,o1_mf_ncsnf_TAG20140329T201841_9mfgqt2s_.bkp 就存储了 spfile和control file的备份。
似乎除了备份集里有,还自动备份了一份出来。
恢复方法,可以参考:http://database.ctocio.com.cn/195/9103695.shtml
本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/p/3633048.html,如需转载请自行联系原作者