[oracle@orcl11 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Nov 8 16:00:58 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1605446691)
修改控制文件备份方式为自动备份
RMAN> configure controlfile autobackup on;
using target database control file instead of recovery catalog
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 ORCL 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/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
创建备份路径
[root@orcl11 /]# mkdir oractlbak
设置控制文件自动备份文件的存放位置
RMAN> configure controlfile autobackup format for device type disk to '/oractlbak/%F';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oractlbak/%F';
new RMAN configuration parameters are successfully stored
验证:
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 ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/oractlbak/%F';
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中使用“backup current controlfile”可完成控制文件的备份
RMAN> backup current controlfile;
Starting backup at 08-Nov-20
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 08-Nov-20
channel ORA_DISK_1: finished piece 1 at 08-Nov-20
piece handle=/u01/app/oracle/fast_recovery_area/ORCL/backupset/2020_11_08/o1_mf_ncnnf_TAG20201108T160544_h8cfcp2g_.bkp tag=TAG20201108T160544 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-Nov-20
Starting Control File and SPFILE Autobackup at 08-Nov-20
piece handle=/oractlbak/c-1605446691-20201108-02 comment=NONE
Finished Control File and SPFILE Autobackup at 08-Nov-20
在RMAN中得到曾经备份过的控制文件信息
RMAN> list backup of controlfile;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 9.36M DISK 00:00:01 08-Nov-20
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20200402T171451
Piece Name: /oractlbak/c-1605446691-20201108-01
Control File Included: Ckp SCN: 1014182 Ckp time: 08-Nov-20
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 9.33M DISK 00:00:02 08-Nov-20
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20201108T160544
Piece Name: /u01/app/oracle/fast_recovery_area/ORCL/backupset/2020_11_08/o1_mf_ncnnf_TAG20201108T160544_h8cfcp2g_.bkp
Control File Included: Ckp SCN: 1014371 Ckp time: 08-Nov-20
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 9.36M DISK 00:00:00 08-Nov-20
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20200402T175047
Piece Name: /oractlbak/c-1605446691-20201108-02
Control File Included: Ckp SCN: 1014378 Ckp time: 08-Nov-20
使用RMAN的copy命令亦完成可对控制文件的备份任务
RMAN> copy current controlfile to '/oractlbak/rman_copy_controlfile.ctl';
Starting backup at 08-Nov-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/oractlbak/rman_copy_controlfile.ctl tag=TAG20200402T181727 RECID=1 STAMP=1036693048
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 08-Nov-20
Starting Control File and SPFILE Autobackup at 08-Nov-20
piece handle=/oractlbak/c-1605446691-20201108-03 comment=NONE
Finished Control File and SPFILE Autobackup at 08-Nov-20
|