ITPub博客

首页 > 数据库 > Oracle > 丢失一个控制文件并恢复数据库

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

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

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

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

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博客 ” ,链接:https://blog.itpub.net/31392094/viewspace-2128902/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-09-06

  • 博文量
    231
  • 访问量
    215130