ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle启动后对控制文件的依赖

Oracle启动后对控制文件的依赖

原创 Linux操作系统 作者:yangtingkun 时间:2009-05-24 23:13:26 0 删除 编辑

今天测试的时候纠正了一个错误的印象,一直认为如果当前控制文件被误删除,会导致实例关闭。

 

 

而实际上,Oracle并不会结束当前的实例:

SQL> show parameter control_files

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/oracle/oradata/db01/contr
                                                 ol01.ctl, /u01/oracle/oradata/
                                                 db01/control02.ctl, /u01/oracl
                                                 e/oradata/db01/control03.ctl
SQL> select * from dual;

D
-
X

SQL> host
oracle:/home/oracle> cd /u01/oracle/oradata/db01
oracle:/u01/oracle/oradata/db01> ls -l *.ctl
-rw-r-----  1 oracle dba 9748480 May 24 12:55 control01.ctl
-rw-r-----  1 oracle dba 9748480 May 24 12:55 control02.ctl
-rw-r-----  1 oracle dba 9748480 May 24 12:55 control03.ctl
oracle:/u01/oracle/oradata/db01> rm control02.ctl
oracle:/u01/oracle/oradata/db01> exit
exit

SQL> select * from dual;

D
-
X

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
db01             OPEN

SQL> alter system checkpoint;

System altered.

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
db01             OPEN

SQL> alter system switch logfile;

System altered.

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
db01             OPEN

SQL> col name format a50
SQL> select * from v$controlfile;

STATUS  NAME                                               IS_ BLOCK_SIZE FILE_SIZE_BLKS
------- -------------------------------------------------- --- ---------- --------------
        /u01/oracle/oradata/db01/control01.ctl             NO       16384            594
        /u01/oracle/oradata/db01/control02.ctl             NO       16384            594
        /u01/oracle/oradata/db01/control03.ctl             NO       16384            594

SQL> select * from v$controlfile_record_section;
select * from v$controlfile_record_section
              *
ERROR at line 1:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oracle/oradata/db01/control02.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3


SQL> select * from v$controlfile;

STATUS  NAME                                               IS_ BLOCK_SIZE FILE_SIZE_BLKS
------- -------------------------------------------------- --- ---------- --------------
        /u01/oracle/oradata/db01/control01.ctl             NO       16384            594
        /u01/oracle/oradata/db01/control02.ctl             NO       16384            594
        /u01/oracle/oradata/db01/control03.ctl             NO       16384            594

可以看到,删除了一个控制文件之后,数据库照常运行,甚至在发现一个控制文件丢失之后,数据库实例仍然处于打开状态,检查一下alert文件:

Thread 1 advanced to log sequence 21 (LGWR switch)
  Current log# 3 seq# 21 mem# 0: /u01/oracle/oradata/db01/redo03.log
Sun May 24 13:00:58 2009
Errors in file /u01/oracle/diag/rdbms/db01/db01/trace/db01_m002_27935.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oracle/oradata/db01/control02.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
Sun May 24 13:24:09 2009
Errors in file /u01/oracle/diag/rdbms/db01/db01/trace/db01_m000_27986.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oracle/oradata/db01/control02.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
Sun May 24 14:01:49 2009
Errors in file /u01/oracle/diag/rdbms/db01/db01/trace/db01_m002_28082.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oracle/oradata/db01/control02.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
Sun May 24 14:24:59 2009
Errors in file /u01/oracle/diag/rdbms/db01/db01/trace/db01_m000_28132.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oracle/oradata/db01/control02.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
Sun May 24 14:59:29 2009
Errors in file /u01/oracle/diag/rdbms/db01/db01/trace/db01_m000_28204.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/oracle/oradata/db01/control02.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3

虽然Oracle认识到一个控制文件出现了异常,但是Oracle并没有关闭当前实例。测试发现,即使删除了所有当前的控制文件,当前实例依然处于打开的状态,并且只有需要访问控制文件的操作会报错,其他操作仍然可以运行。

Oracle既然不会自动关闭,那么万一出现了控制文件误删除的情况,一定不要手工关闭当前的实例,只要实例不关闭,就可以轻松的查询数据库中的数据文件、日志文件等信息来重建控制文件,而一旦关闭了实例,由于缺失控制文件,实例将无法启动,这时候要找到所有控制文件中包含的信息就比较困难了。

 

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

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10441595