0. ENV
RHEL6.4/ORACLE 12.2.0.1 单机文件系统
强大的oracle出现控制文件异常的几率是比较小的,但是人为误操作的可能性就相对比较大。
本次模拟存在多个冗余控制文件时,一个控制文件被误删除的恢复过程。
后续提供当所有控制文件被删除时,分别采用文件描述符方式和重建控制文件方式对控制文件进行恢复。
1. 误删控制文件
1) 当前共2个控制文件
SYS@orcl> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/oradata/orcl/control01.ctl
/oradata/orcl/control02.ctl
2) 误删控制文件2
SYS@orcl> ! rm -f oradata/orcl/control02.ctl
3) 此时alert中会有报错:
2021-03-23T23:25:15.485270+08:00
Errors in file u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_arc1_2768.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oradata/orcl/control02.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
4) 关闭数据库报错
SYS@orcl> shut immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/oradata/orcl/control02.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
2. 解决方法
一直性关闭数据库后,使用冗余控制文件进行恢复。
1) 再次强制关闭数据库
SYS@orcl> shut abort
ORACLE instance shut down.
2) 将冗余的控制文件复制一份恢复
SYS@orcl> ! cp oradata/orcl/control01.ctl oradata/orcl/control02.ctl
3) 启动数据库-恢复正常
SYS@orcl> startup
ORACLE instance started.
Total System Global Area 587202560 bytes
Fixed Size 8623352 bytes
Variable Size 339741448 bytes
Database Buffers 230686720 bytes
Redo Buffers 8151040 bytes
Database mounted.
Database opened.
数据库恢复正常。
3. 异常处理
如果在数据库没有关闭完全,而copy了控制文件,再次关闭数据库会有报错
1) alert中告警
提示控制头部信息较旧,不要进行重启实例。
为了安全重启实例,建议安装alert中4步骤进行操作,进行控制文件重建。
2021-03-23T23:43:56.998192+08:00
********************* ATTENTION: ********************
The controlfile header block returned by the OS
has a sequence number that is too old.
The controlfile might be corrupted.
PLEASE DO NOT ATTEMPT TO START UP THE INSTANCE
without following the steps below.
RE-STARTING THE INSTANCE CAN CAUSE SERIOUS DAMAGE
TO THE DATABASE, if the controlfile is truly corrupted.
In order to re-start the instance safely,
please do the following:
(1) Save all copies of the controlfile for later
analysis and contact your OS vendor and Oracle support.
(2) Mount the instance and issue:
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
(3) Unmount the instance.
(4) Use the script in the trace file to
RE-CREATE THE CONTROLFILE and open the database.
*****************************************************
USER (ospid: 15285): terminating the instance
当前这些提示时,数据库已关闭。
2) 操作方案
确保没有oracle进程启动
[oracle@db orcl]$ ps -ef |grep ora
如果启动状态,还需要shut abort关闭
3) 数据库进程没有启动时,从新copy正常的控制文件到异常控制文件
[oracle@db ~]$ cp /oradata/orcl/control01.ctl /oradata/orcl/control02.ctl
4) 启动数据库-恢复正常
SYS@orcl> startup




