丢失一个控制文件并恢复数据库

只丢失或损坏 一个控制文件的情况下来恢复数据库,相对来说简单一点。一般来说,控制文件都需要形成
一个多路径冗余策略,来提高数据库的安全性。这样的话 只需将完好的控制文件复制一个副本放到丢失或者
损坏了的控制文件所在路径的目录下,这样启动数据库就能够识别得到控制文件 ,也就能够恢复数据库了。
以下是测试的过程:

----丢失一个控制文件恢复数据库:

---查看控制文件的信息:

sys@PROD>select name from v$controlfile;

NAME

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

/u01/app/oracle/oradata/PROD/control01.ctl

/u01/app/oracle/fast_recovery_area/PROD/control02.ctl


---删除2号控制文件模拟丢失控制文件:

[oracle@enmo PROD]$ pwd

/u01/app/oracle/fast_recovery_area/PROD

[oracle@enmo PROD]$ ls

archivelog  autobackup  control02.ctl  onlinelog

[oracle@enmo PROD]$ rm control02.ctl

[oracle@enmo PROD]$ ls

archivelog  autobackup  onlinelog

[oracle@enmo PROD]$

#已经成功删除2号控制文件。


---尝试创建一个表空间:

sys@PROD>create tablespace test datafile

  2  '/u01/app/oracle/oradata/PROD/test01.dbf' size 10M;

create tablespace test datafile

*

ERROR at line 1:

ORA-00210: cannot open the specified control file

ORA-00202: control file:

'/u01/app/oracle/fast_recovery_area/PROD/control02.ctl'

ORA-27041: unable to open file

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

Additional information: 3

#报错:ORA-00210,不能识别并把创建表空间的信息注册到2号控制文件。

---尝试关库:

sys@PROD>shutdown immediate;

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/fast_recovery_area/PROD/control02.ctl'

ORA-27041: unable to open file

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

Additional information: 3

sys@PROD>

#同样的报错ORA-00210

---强行关库:

sys@PROD>shutdown abort;

ORACLE instance shut down.

sys@PROD>

---退出sqlplus并重新登录数据库:

[oracle@enmo ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 22 23:30:48 2016

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

Connected to an idle instance.


PROD>startup

ORACLE instance started.


Total System Global Area  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             507513936 bytes

Database Buffers          322961408 bytes

Redo Buffers                2371584 bytes

ORA-00205: error in identifying control file, check alert log for more info

#报错:ORA-00205,能识别并打开控制文件。

--查看此时实例的状态:

PROD>select status from v$instance;

STATUS

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

STARTED


---系统层从1号控制文件复制一个放到2号控制文件原来的目录:

[oracle@enmo PROD]$ pwd

/u01/app/oracle/oradata/PROD

[oracle@enmo PROD]$ cp control01.ctl /u01/app/oracle/fast_recovery_area/PROD/control02.ctl

[oracle@enmo PROD]$


[oracle@enmo PROD]$ pwd

/u01/app/oracle/fast_recovery_area/PROD

[oracle@enmo PROD]$ ls

archivelog  autobackup  control02.ctl  onlinelog

#完成复制。


---把实例调至mount状态与open状态:

PROD>alter database mount;

Database altered.

PROD>alter database open;

Database altered.

#控制恢复完成,数据库恢复完成。

--这种情况恢复数据库的难度不到,工作量也相对少一点,最关键一点就是丢失一个或多个控制文件后,
能够有且至少还有一个冗余的控制文件映射。

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

转载于:http://blog.itpub.net/31392094/viewspace-2128902/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值