丢失一个控制文件
1) 删除 2 号控制文件,制造错误
[oracle@wang ~]$ cd /u01/app/oracle/oradata/ORA11GR2/
[oracle@wang ORA11GR2]$
[oracle@wang ORA11GR2]$ pwd
/u01/app/oracle/oradata/ORA11GR2
[oracle@wang ORA11GR2]$
[oracle@wang ORA11GR2]$ ls cont*
control01.ctl control02.ctl
[oracle@wang ORA11GR2]$ rm control01.ctl
[oracle@wang ORA11GR2]$ ls cont*
control02.ctl
[oracle@wang ORA11GR2]$
2) 以 sysdba 身份登录 sqlplus 创建一个表空间,当创建表空间时(即数据库结构发生变化,更新控制文件,出现了错误)
SYS@ORA11GR2>select status from v$instance;
STATUS
------------
OPEN
SQL> create tablespace ts_control datafile 2 '/u01/app/oracle/oradata/ORA11GR2/ts_control.dbf' size 10m;
create tablespace ts_control datafile
*
ERROR at line 1:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
3) 退出 sqlplus,重新登录数据库
可以正常登录(这点跟控制文件认为版本不一致略有同),没有显示错误,此时要恢复控制文件,需要
shutdown,发现 shutdown immediate 是无法 down 下来的,只能 shutdown abort
SQL> 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@wang ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 23 06:39:58 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
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> shutdown immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL>
SQL> shutdown abort;
ORACLE instance shut down.
4) 通过启动数据库时的错误提示信息我们已经清楚的知道, 2 号控制文件找不到了,拷贝现有的控制文件,并命名为 2 号控制文件
SQL> host
[oracle@wang ~]$ cd /u01/app/oracle/oradata/ORA11GR2/
[oracle@wang ORA11GR2]$ ls con*
control02.ctl
[oracle@wang ORA11GR2]$ cp control02.ctl control01.ctl
[oracle@wang ORA11GR2]$ ls con*
control01.ctl control02.ctl
[oracle@wang ORA11GR2]$ exit
exit
5) 再次启动数据库,一切正常,轻松愉快的解决了丢失控制文件的问题。
SQL> startupORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 503319672 bytes
Database Buffers 322961408 bytes
Redo Buffers 2392064 bytes
Database mounted.
Database opened.
SQL> select status from v$instance;
STATUS
------------
OPEN
6) 小结:
丢失一个控制文件是一个非常好解决的问题,只要我们知道原理(控制文件是互为镜像的),就很好解
决这个问题,通过实验我们还要知道,控制文件的重要性(号称 oracle 数据库的大脑,记录这整个数据
库的结构信息),一定不要出现单点情况
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31397003/viewspace-2126761/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31397003/viewspace-2126761/