使用RMAN备份控制文件(control file)和系统参数文件(spfile)
1、Use the CONFIGURE CONTROLFILE AUTOBACKUP command to eanable
设置RMAN配置文件,将CONFIGE CONTROLFILE AUTOBACKUP 为ON状态,可以是实现控制文件的备份。如果CONFIGURE CONTROLFILE AUTOBACKUP 为OFF,那么在备份system表空间的时候,也会备份congrol file。
2、when enabled,RMAN automatically performs a back up of the control file and current server parameter file after BACKUP or COPY commands.
3、Back ups also occur after structural changes to the database .
4、Backup is given a default name.
备份Controlfile与system parameter file的方法
(一)、设置如下配置参数,实现controlfile与system parameter file的备份
RMAN> show all; RMAN configuration parameters for database with db_unique_name POLI 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 '/u01/oracle/dbs/snapcf_poli.f'; # default
(二)、执行命令backup current controlfile,实现controlfile与spfile的备份;(单独执行controlfile与spfile的命令)
RMAN> backup current controlfile; Starting backup at 23-MAR-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 23-MAR-13 channel ORA_DISK_1: finished piece 1 at 23-MAR-13 piece handle=/u01/flash_recovery_area/POLI/backupset/2013_03_23/o1_mf_ncnnf_TAG20130323T234359_8nvmg18j_.bkp tag=TAG20130323T234359 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 Finished backup at 23-MAR-13 Starting Control File Autobackup at 23-MAR-13 piece handle=/u01/flash_recovery_area/POLI/autobackup/2013_03_23/o1_mf_n_810863044_8nvmg4dv_.bkp comment=NONE Finished Control File Autobackup at 23-MAR-13
(三)、使用include子句,实现control file的备份
RMAN> backup datafile 4 include current controlfile; Starting backup at 23-MAR-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=/u01/oradata/poli/users01.dbf channel ORA_DISK_1: starting piece 1 at 23-MAR-13 channel ORA_DISK_1: finished piece 1 at 23-MAR-13 piece handle=/u01/flash_recovery_area/POLI/backupset/2013_03_23/o1_mf_nnndf_TAG20130323T234751_8nvmo843_.bkp tag=TAG20130323T234751 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03 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 23-MAR-13 channel ORA_DISK_1: finished piece 1 at 23-MAR-13 piece handle=/u01/flash_recovery_area/POLI/backupset/2013_03_23/o1_mf_ncnnf_TAG20130323T234751_8nvmod9y_.bkp tag=TAG20130323T234751 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 23-MAR-13 Starting Control File Autobackup at 23-MAR-13 piece handle=/u01/flash_recovery_area/POLI/autobackup/2013_03_23/o1_mf_n_810863277_8nvmofjy_.bkp comment=NONE Finished Control File Autobackup at 23-MAR-13
(四)、使用SQL命令备份controlfile
RMAN> sql "alter database backup controlfile to ''/tmp/poli_df.bak''"; sql statement: alter database backup controlfile to ''/tmp/poli_df.bak''