【备份恢复】 控制文件之版本不一致 之恢复操作

 版本不一致
1) 模拟错误

[oracle@wang ORA11GR2]$ pwd

/u01/app/oracle/oradata/ORA11GR2

[oracle@wang ORA11GR2]$ ls control*

control01.ctl  control02.ctl

[oracle@wang ORA11GR2]$ cp control02.ctl  control02.ctl.bak

[oracle@wang ORA11GR2]$ ls control*

control01.ctl  control02.ctl  control02.ctl.bak

[oracle@wang ORA11GR2]$

 

2) sysdba 身份登录 sqlplus,手动触发一下检查点(这步可执行可不执行,执行的目的是,让控
制文件快速的版本不一致,当然,就算不执行,也是不一致的)

[oracle@wang ORA11GR2]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu Sep 22 23:00:00 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SYS@ORA11GR2>alter system checkpoint;

 

System altered.

 

3)删除当前 2 号控制文件,并将之前备份的控制文件改为 2 号控制文件

SYS@ORA11GR2>host ls control*

control01.ctl  control02.ctl  control02.ctl.bak

 

SYS@ORA11GR2>ho rm control02.ctl

 

SYS@ORA11GR2>ho ls control*

control01.ctl  control02.ctl.bak

 

SYS@ORA11GR2>! mv control02.ctl.bak control02.ctl

 

SYS@ORA11GR2> ! ls control*

control01.ctl  control02.ctl

 

4) 再次执行检查点,执行正常(虽然执行 alter system checkpoint;完全检查点,但 oracle实际上并未真正同步 SCN,还在排队中),创建表空间,报 ORA-03113 错误。注意: 此时, sqlplus 已经断开连接,数据库 down 了下来

 

SYS@ORA11GR2>create tablespace ts_control datafile   2  '/u01/app/oracle/oradata/ORA11GR2/ts_control.dbf' size 10m;

ERROR:

ORA-03114: not connected to ORACLE

 

create tablespace ts_control datafile

*

ERROR at line 1:

ORA-03113: end-of-file on communication channel

Process ID: 2964

Session ID: 39 Serial number: 367

 

查看alert日志:

[oracle@wang trace]$ pwd

/u01/app/oracle/diag/rdbms/ora11gr2/ORA11GR2/trace

[oracle@wang trace]$ tail -100f alert_ORA11GR2.log

 

注 在创建表空间报错时, alert 日志有如下输出

------------------------------------------------------------------------------
Thu Sep 22 23:03:11 2016

Errors in file /u01/app/oracle/diag/rdbms/ora11gr2/ORA11GR2/trace/ORA11GR2_m000_3187.trc:

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control02.ctl'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Thu Sep 22 23:07:32 2016

create tablespace ts_control datafile

'/u01/app/oracle/oradata/ORA11GR2/ts_control.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.

*****************************************************

USER (ospid: 2964): terminating the instance

Thu Sep 22 23:07:32 2016

System state dump requested by (instance=1, osid=2964), summary=[abnormal instance termination].

System State dumped to trace file /u01/app/oracle/diag/rdbms/ora11gr2/ORA11GR2/trace/ORA11GR2_diag_28867_20160922230732.trc

Dumping diagnostic data in directory=[cdmp_20160922230732], requested by (instance=1, osid=2964), summary=[abnormal instance termination].

Instance terminated by USER, pid = 2964

5) 退出 sqlplus,重新登录
注意: 此时提示,连接到一个空闲实例

[oracle@wang backup]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu Sep 22 23:19:50 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

Connected to an idle instance.

 

6) 启动数据库,此时提示,控制文件版本不统一

SYS@ORA11GR2>startup

ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance

ORACLE instance started.

 

Total System Global Area  830930944 bytes

Fixed Size                  2257800 bytes

Variable Size             503319672 bytes

Database Buffers          322961408 bytes

Redo Buffers                2392064 bytes

ORA-00214: control file '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'

version 2057 inconsistent with file

'/u01/app/oracle/oradata/ORA11GR2/control02.ctl' version 2055

 

7) 回到 linux 系统,删除版本低的 2号控制文件, 通过版本比较高的 1 号控制文件复制创建一个2 号控制文件

[oracle@wang backup]$ cd /u01/app/oracle/oradata/ORA11GR2/

[oracle@wang ORA11GR2]$ ls cont*

control01.ctl  control02.ctl

[oracle@wang ORA11GR2]$ rm control02.ctl

[oracle@wang ORA11GR2]$ ls cont*

control01.ctl

[oracle@wang ORA11GR2]$ cp control01.ctl control02.ctl

[oracle@wang ORA11GR2]$ ls cont*

control01.ctl  control02.ctl

[oracle@wang ORA11GR2]$

 

8) 回到 sqlplus,将数据库启动到 mount 状态下, mount 成功,说明控制文件版本已经统一, open数据库

[oracle@wang ORA11GR2]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu Sep 22 23:24:41 2016

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SYS@ORA11GR2>select status from v$instance;

 

STATUS

------------

STARTED

 

SYS@ORA11GR2>alter database mount;

 

Database altered.

 

SYS@ORA11GR2>alter database open;

 

Database altered.

 

恢复成功!!!!!!!!!!!!!!!!!

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31397003/viewspace-2126760/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31397003/viewspace-2126760/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值