解决oracle误删除dbf文件而不能启动的问题


首先这种方法不能恢复你误删除的数据,只是一种能让数据库正常启动的方案。

由于误操作删除了oracle数据库的dbf文件,启动数据库的时候报错

SQL> startup pfile=’/ytxt/oracle/product/10.2.0/db_1/dbs/initshutu.ora’;
ORACLE instance started.

Total System Global Area 3290345472 bytes
Fixed Size    2217832 bytes
Variable Size 2332035224 bytes
Database Buffers  939524096 bytes
Redo Buffers   16568320 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: ’/ytxt/oracle/oradata/shutu/TYBOOKDB.dbf’
蛋疼,无奈就找解决办法。

执行以下步骤即可解决:

SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
启动mount模式,由于本机器有点问题所有startup mount起不来,一般都是可以的,所以不只能用下面的命令起来
SQL> startup mount;
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address ’(ADDRESS=(PROTOCOL=TCP)(HOST=sc-orc-1.tylib.com)(PORT=1521))’

SQL>  startup pfile=’/ytxt/oracle/product/10.2.0/db_1/dbs/initshutu.ora’ mount;
ORACLE instance started.

Total System Global Area 3290345472 bytes
Fixed Size    2217832 bytes
Variable Size 2332035224 bytes
Database Buffers  939524096 bytes
Redo Buffers   16568320 bytes
Database mounted.
SQL> alter database datafile  ’/ytxt/oracle/oradata/shutu/TYBOOKDB.dbf’ offline drop;

Database altered.

SQL> alter database open;

Database altered.

停止数据库,然后启动数据库看看成功没有:

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup  pfile=’/ytxt/oracle/product/10.2.0/db_1/dbs/initshutu.ora’;
ORACLE instance started.

Total System Global Area 3290345472 bytes
Fixed Size    2217832 bytes
Variable Size 2332035224 bytes
Database Buffers  939524096 bytes
Redo Buffers   16568320 bytes
Database mounted.
Database opened.
完全没问题。此问题已解决。


Whatever is worth doing is worth doing well.