一、测试环境 数据库版本:11.2.0.4 操作系统版本:CentOS Linuxrelease 7.9.2009 (Core) 数据库归档:未开启 备份情况:无任何备份 二、模拟控制文件丢失 1. 查看数据库控制文件路径 SQL>show parameter control NAME TYPE VALUE ----------------------------------------------- ------------------------------ control_file_record_keep_time integer 7 control_files string /u01/app/oracle/oradata/orcl/c ontrol01.ctl, /u01/app/oracle/ fast_recovery_area/orcl/contro l02.ctl control_management_pack_access string DIAGNOSTIC+TUNING 2. 关闭数据库 SQL>shutdown immediate Databaseclosed. Databasedismounted. ORACLEinstance shut down. 3. 删除所有控制文件 4. 启动数据库报错 SQL>startup ORACLEinstance started. TotalSystem Global Area 1820540928 bytes FixedSize 2254184 bytes VariableSize 503319192 bytes DatabaseBuffers 1308622848 bytes RedoBuffers 6344704 bytes ORA-00205:error in identifying control file, check alert log for more info 三、处理方法 一)、如果及时发现了数据库还未关闭,则可以使用命令将重建控制文件的脚本输出到trace文件中,方便控制文件的重建操作 alter databasebackupcontrolfile to trace ; 二)、如果数据库已经关闭了发现控制文件丢失,那么需要重建控制文件 SQL>CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG 2 MAXLOGFILES 16 3 MAXLOGMEMBERS 3 4 MAXDATAFILES 100 5 MAXINSTANCES 8 6 MAXLOGHISTORY 292 7 LOGFILE 8 GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' size 50M, 9 GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' size 50M, 10 GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' size 50M 11 DATAFILE 12 '/u01/app/oracle/oradata/orcl/system01.dbf', 13 '/u01/app/oracle/oradata/orcl/sysaux01.dbf', 14 '/u01/app/oracle/oradata/orcl/undotbs01.dbf', 15 '/u01/app/oracle/oradata/orcl/users01.dbf', 16 '/u01/app/oracle/oradata/orcl/example01.dbf'; Controlfile created. SQL>select status from v$instance ; STATUS ------------ MOUNTED 打开数据库: SQL>alter database open ; Databasealtered. 查看临时文件情况: SQL>select name from v$tempfile; no rowsselected 添加临时文件: SQL>ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'; Tablespacealtered. SQL>select name from v$tempfile; NAME -------------------------------------------------------------------------------- /u01/app/oracle/oradata/orcl/temp01.dbf 查看控制文件原路径下已经重新生成了控制文件 数据库状态正常: SQL>select open_mode,database_role from v$database; OPEN_MODE DATABASE_ROLE ------------------------------------ READWRITE PRIMARY
|