关于数据库丢失控制文件的测试

数据库丢失控制文件的情况有几种:
1.删除
2.重命名
3.清空
4.控制文件所在的磁盘损坏.
另外,数据库的控制文件可能会有两个、三个或多个的情况.


下面是我的测试结果
1.删除
如果是删除的话,如果删除掉一个或者都删掉,数据库不会宕,依旧会正常运行,一直到下次重启的时候,数据库在检查丢失控制文件会报错然后无法启动,需要恢复;因此,删除控制文件不会对当前的数据库运行产生影响,但是需要注意下次重启的时候会报错并无法启动。

2.重命名
重命名也不会影响当前数据库的正常运行,并且数据库会依旧更新重命名后的那个文件,这个应该是由于系统的inode没有改变的缘故。
同样的现象trace文件也同样出现,如果跟踪了一个sid的trace,生成的trace文件我们将其移到另一个目录或者重命名成另外一个文件,只要跟踪的那个sid不退出,数据库依旧会写重命名后的那个trace文件.

3.清空
清空控制文件,无论是清空一个,还是清空所有的控制文件,清空完成之后再执行一次alter system checkpoint;之后,数据库就会宕掉,报如下的错误:
Sat Jan 7 18:31:59 2012
Hex dump of (file 0, block 1) in trace file /home/oracle/admin/TESTDB/bdump/testdb_ckpt_10207.trc
Corrupt block relative dba: 0x00000001 (file 0, block 1)
Completely zero block found during control file header read
Sat Jan 7 18:31:59 2012
Errors in file /home/oracle/admin/TESTDB/bdump/testdb_ckpt_10207.trc:
ORA-00202: control file: '/u01/oracle/TESTDB/cfile/ora_control1.ctl'
Sat Jan 7 18:31:59 2012
Errors in file /home/oracle/admin/TESTDB/bdump/testdb_ckpt_10207.trc:
ORA-00227: corrupt block detected in control file: (block 1, # blocks 1)
ORA-00202: control file: '/u01/oracle/TESTDB/cfile/ora_control1.ctl'
CKPT: terminating instance due to error 227
Instance terminated by CKPT, pid = 10207

4.控制文件所在的磁盘损坏
无论有几个控制文件,两个或者三个;在损坏的磁盘上的控制文件有一个或者全部都在损坏的磁盘上,都会导致数据库马上宕掉。
同时在alert日志中报如下的错误:
ORA-00206: error in writing (block 3, # blocks 1) of control file
ORA-00202: control file: '/u01/oracle/TESTDB/cfile/ora_control2.ctl'
ORA-27072: File I/O error
Linux Error: 5: Input/output error
Additional information: 4
Additional information: 3
Additional information: -1
ORA-00206: error in writing (block 3, # blocks 1) of control file
ORA-00202: control file: '/u01/oracle/TESTDB/cfile/ora_control1.ctl'
ORA-27072: File I/O error
Linux Error: 5: Input/output error
Additional information: 4
Additional information: 3
Additional information: -1
Sat Jan 7 15:22:55 2012
CKPT: terminating instance due to error 221
Instance terminated by CKPT, pid = 8601

在ckpt生成的trace文件中生成下面的错误:
Dump file /home/oracle/admin/TESTDB/bdump/testdb_ckpt_10054.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /home/oracle/oracle/product/10.2.0/db_1
System name: Linux
Node name: localhost.localdomain
Release: 2.6.9-89.0.0.0.1.ELhugemem
Version: #1 SMP Tue May 19 04:38:38 EDT 2009
Machine: i686
Instance name: TESTDB
Redo thread mounted by this instance: 1
Oracle process number: 7
Unix process pid: 10054, image: oracle@localhost.localdomain (CKPT)

*** 2012-01-07 18:03:28.521
*** SERVICE NAME:(SYS$BACKGROUND) 2012-01-07 18:03:28.518
*** SESSION ID:(165.1) 2012-01-07 18:03:28.517
ORA-00206: error in writing (block 3, # blocks 1) of control file
ORA-00202: control file: '/u01/oracle/TESTDB/cfile/ora_control1.ctl'
ORA-27072: File I/O error
Linux Error: 5: Input/output error
Additional information: 4
Additional information: 3
Additional information: -1
error 221 detected in background process
ORA-00221: error on write to control file
ORA-00206: error in writing (block 3, # blocks 1) of control file
ORA-00202: control file: '/u01/oracle/TESTDB/cfile/ora_control1.ctl'
ORA-27072: File I/O error
Linux Error: 5: Input/output error
Additional information: 4
Additional information: 3
Additional information: -1

关于磁盘损坏的测试是在vmware虚拟机上进行,测试方法如下:
1.用虚拟机单独给linux系统添加一块磁盘;
2.将磁盘mount到某一个文件系统上,如/u01;
3.将控制文件放在这个文件系统/u01上;
4.启动数据库,之后进行模拟磁盘故障;
5.在虚拟机上删除硬盘。然后在linux系统中df -m虽然还能看到文件系统在线,但其实已经相当于是磁盘损坏了.在删除磁盘的同时,数据库抛出错误并abort.
6.模拟测试结束.

[@more@]

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

转载于:http://blog.itpub.net/23850820/viewspace-1057488/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值