oracle数据文件被误删除后的灾难处理方法- -
Tag:
oracle
datafile
数据文件
误删除
灾难 环境:Red Hat Linux 7.2 SMP 数据库:Oracle 8.1.7 起因,一同事建立了一个表空间并建立一张表后发现表空间未用到直接删除了那个数据文件.其操作如下: create tablespace r_csh_20051001 datafile '/webdata/dbdata/ry/csh20051001.dat' size 50M autoextend on next 500M default storage (initial 10m NEXT 10m MINEXTENTS 1 PCTINCREASE 0); create table r_csh( UsedDate char(26) default '', CardNumber char(26) default '', UserNumber char(16) default '', Credit number(5) default 0, UserArea number(6) default 0, CardArea number(6) default 0, ValiDdate char(26) default '' ); rm /webdata/dbdata/ry/csh20051001.dat 经过这一操作后,数据库出现连接失败,发现数据库已经停止了. 查看oracle的log显示: Errors in file /oracle/admin/webdb/bdump/ckpt_31638.trc: ORA-01110: data file 63: '/webdata/dbdata/ry/csh20051001.dat' ORA-01115: IO error reading block from file 63 (block # 1) ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 ORA-01242: data file suffered media failure: database in NOARCHIVELOG mode ORA-01116: error in opening database file 63 ORA-01110: data file 63: '/webdata/dbdata/ry/csh20051001.dat' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 Fri Oct 21 15:31:47 2005 CKPT: terminating instance due to error 1242 Instance terminated by CKPT, pid = 31638 Fri Oct 21 15:55:09 2005 想要把oracle重新启动,发现也启动不了: SQL> shutdown immediate; SQL> startup; ORACLE instance started. Total System Global Area 40104096 bytes Fixed Size 73888 bytes Variable Size 23080960 bytes Database Buffers 16777216 bytes Redo Buffers 172032 bytes Database mounted. ORA-01122: database file 63 failed verification check ORA-01110: data file 63: '/webdata/dbdata/ry/csh20051001.dat' ORA-01251: Unknown File Header Version read for file number 63 分析问题: 因为数据文件在没有被offline的情况下实物理删除了,导致oracle的数据不一致,因此启动失败. 解决方法: lsnrctl stop sqlplus internal SQL> shutdown abort SQL> startup mount SQL> alter database datafile '/webdata/dbdata/ry/csh20051001.dat' offline drop; SQL> alter database open; SQL> drop tablespace r_csh_20051001; lsnrctl start 其中省略了屏幕输出内容. 小结:oracle数据文件(datafile)被误删除后没有恢复的办法,只能把该数据文件offline后drop掉 这是我们的实际操作记载!