Oracle Database物理文件之控制文件
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 -- 连接到目标数据库 RMAN connect target /; connected to target database: ORCL (DBID=1364371964) -- 备份控制文件 RMAN backup current controlfile; Starting backup at 23-FEB-14 using ta
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入
-- 连接到目标数据库
RMAN> connect target /;
connected to target database: ORCL (DBID=1364371964)
-- 备份控制文件
RMAN> backup current controlfile;
Starting backup at 23-FEB-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=21 device type=DISK
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-FEB-14
channel ORA_DISK_1: finished piece 1 at 23-FEB-14
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_02_23/o1_mf_ncnnf_TAG20140223T094340_9jlnlfnn_.bkp tag=TAG20140223T094340 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-FEB-14
-- 备份数据库及控制文件,数据库需要处于archivelog模式下
RMAN> backup database include current controlfile;
Starting backup at 23-FEB-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=142 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=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-FEB-14
channel ORA_DISK_1: finished piece 1 at 23-FEB-14
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_02_23/o1_mf_nnndf_TAG20140223T095613_9jlo9y7y_.bkp tag=TAG20140223T095613 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:45
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 23-FEB-14
channel ORA_DISK_1: finished piece 1 at 23-FEB-14
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2014_02_23/o1_mf_ncsnf_TAG20140223T095613_9jlof8l7_.bkp tag=TAG20140223T095613 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-FEB-14
-- 查看当前的RMAN 参数设定
RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION OFF;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP OFF; -- 默认自动备份控制文件为关闭状态
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE ENCRYPTION FOR DATABASE OFF;
CONFIGURE ENCRYPTION ALGORITHM 'AES128';
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.20.1/db_1/dbs/snapcf_orcl.f';
-- 设置开启RMAN自动备份控制文件
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
五 控制文件的缺失恢复
1.丢失多个控制文件中的一个或多个
缺失多个控制文件中的一个或多个,数据库启动时会报ORA-00205错误,导致数据库无法启动,如下:
idle>startup
ORACLE instance started.
Total System Global Area 1050411008 bytes
Fixed Size 1341168 bytes
Variable Size 641730832 bytes
Database Buffers 402653184 bytes
Redo Buffers 4685824 bytes
ORA-00205: error in identifying control file, check alert log for more info
-- 查看警告日志的位置,一般在数据库参数background_dump_dest指定的目录下
idle>show parameter dump
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
background_core_dump string partial
background_dump_dest string /u01/app/oracle/diag/rdbms/orcl/orcl/trace
core_dump_dest string /u01/app/oracle/diag/rdbms/orc l/orcl/cdump
max_dump_file_size string unlimited
shadow_core_dump string partial
user_dump_dest string /u01/app/oracle/diag/rdbms/orc l/orcl/trace
-- 查看警告日志中的错误信息,找不到控制文件
[oracle@db trace]$ tail -f alert_orcl.log
Sun Feb 23 10:08:13 2014
ALTER DATABASE MOUNT
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-205 signalled during: ALTER DATABASE MOUNT…
Sun Feb 23 10:08:14 2014
Checker run found 1 new persistent data failures
[1] [2] [3] [4]