恢复控制文件(一) 版本不一致
1. 模拟错误
备份3号控制文件
[oracle@host01 PROD1]$ ls
control01.ctl example01.dbf redo02.log sysaux01.dbf temp01.dbf undotbs01.dbf
control03.ctl redo01.log redo03.log system01.dbf ts_01.dbf users01.dbf
[oracle@host01 PROD1]$ cp control03.ctl control03.ctl.bak
2.登录sqlplus触发检查点,目的是让控制文件版本快速不一致
SYS@PROD1>alter system checkpoint;
System altered.
3.删除当前的3号控制文件,并将之前备份的3号控制文件拷贝回来
[oracle@host01 PROD1]$ rm control03.ctl
[oracle@host01 PROD1]$ cp control03.ctl.bak control03.ctl
再次执行检查点,执行正常(虽然执行alter system checkpoint是完全检查点,但oracle实际上并未真正同步scn,还在排队中),创建表空间
报ORA-03113错误
SYS@PROD1>alter system checkpoint;
System altered.
4.等一段时间,再创建表空间会失败(立刻创建有可能成功)
SYS@PROD1>create tablespace ts_control datafile '/u01/app/oracle/oradata/PROD1/ts_control01.dbf' size 10m;
create tablespace ts_control datafile '/u01/app/oracle/oradata/PROD1/ts_control01.dbf' size 10m
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 5310
Session ID: 44 Serial number: 175
查看altert日志
create tablespace ts_control datafile '/u01/app/oracle/oradata/PROD1/ts_control01.dbf' size 10m
********************* 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.
5.退出重新重新登录,连接到空闲实例
SYS@PROD1>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@host01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 15 23:05:09 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
6.启动数据库,提示控制文件版本不一致
SYS@PROD1>startup;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 520096848 bytes
Database Buffers 310378496 bytes
Redo Buffers 2371584 bytes
ORA-00214: control file '/u01/app/oracle/oradata/PROD1/control01.ctl' version
1688 inconsistent with file '/u01/app/oracle/oradata/PROD1/control03.ctl'
version 1683
7.删除旧版本的3号控制文件,拷贝1号控制文件为3号控制文件
[oracle@host01 PROD1]$ rm control03.ctl
[oracle@host01 PROD1]$ cp control01.ctl control03.ctl
8.此时可以启动到mount状态,说明控制文件版本一致
SYS@PROD1>alter database mount;
Database altered.
SYS@PROD1>alter database open;
Database altered.
1. 模拟错误
备份3号控制文件
[oracle@host01 PROD1]$ ls
control01.ctl example01.dbf redo02.log sysaux01.dbf temp01.dbf undotbs01.dbf
control03.ctl redo01.log redo03.log system01.dbf ts_01.dbf users01.dbf
[oracle@host01 PROD1]$ cp control03.ctl control03.ctl.bak
2.登录sqlplus触发检查点,目的是让控制文件版本快速不一致
SYS@PROD1>alter system checkpoint;
System altered.
3.删除当前的3号控制文件,并将之前备份的3号控制文件拷贝回来
[oracle@host01 PROD1]$ rm control03.ctl
[oracle@host01 PROD1]$ cp control03.ctl.bak control03.ctl
再次执行检查点,执行正常(虽然执行alter system checkpoint是完全检查点,但oracle实际上并未真正同步scn,还在排队中),创建表空间
报ORA-03113错误
SYS@PROD1>alter system checkpoint;
System altered.
4.等一段时间,再创建表空间会失败(立刻创建有可能成功)
SYS@PROD1>create tablespace ts_control datafile '/u01/app/oracle/oradata/PROD1/ts_control01.dbf' size 10m;
create tablespace ts_control datafile '/u01/app/oracle/oradata/PROD1/ts_control01.dbf' size 10m
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 5310
Session ID: 44 Serial number: 175
查看altert日志
create tablespace ts_control datafile '/u01/app/oracle/oradata/PROD1/ts_control01.dbf' size 10m
********************* 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.
5.退出重新重新登录,连接到空闲实例
SYS@PROD1>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@host01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 15 23:05:09 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
6.启动数据库,提示控制文件版本不一致
SYS@PROD1>startup;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 520096848 bytes
Database Buffers 310378496 bytes
Redo Buffers 2371584 bytes
ORA-00214: control file '/u01/app/oracle/oradata/PROD1/control01.ctl' version
1688 inconsistent with file '/u01/app/oracle/oradata/PROD1/control03.ctl'
version 1683
7.删除旧版本的3号控制文件,拷贝1号控制文件为3号控制文件
[oracle@host01 PROD1]$ rm control03.ctl
[oracle@host01 PROD1]$ cp control01.ctl control03.ctl
8.此时可以启动到mount状态,说明控制文件版本一致
SYS@PROD1>alter database mount;
Database altered.
SYS@PROD1>alter database open;
Database altered.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31400681/viewspace-2130735/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31400681/viewspace-2130735/