Oracle表空间文件损坏导致的数据库异常关闭并启动失败问题的解决方法

Oracle表空间文件损坏导致的数据库异常关闭并启动失败问题的解决方法

 

问题记录:

通过业务不正常发现Oracle数据库异常关闭,尝试启动Oracle数据库失败。     

SQL> startup force

ORACLE instance started.

Total System Global Area 1603411968 bytes

Fixed Size                  2160112 bytes

Variable Size            1023412752 bytes

Database Buffers          570425344 bytes

Redo Buffers                7413760 bytes

Database mounted.

ORA-01113: file 15 needs media recovery

ORA-01110: data file 15: '/home/bill/oracledata/TBS_REPORT_DATA DATAFILE.bdf'

尝试查看数据库表空间文件,进入目录/home/bill/oracledata后执行ls命令无影响,应该是表空间文件损坏。

解决过程:

(1) 检查Oracle日志文件alter_ORACLE_SID.log

      发现三个数据库表空间文件出现这个问题:

      /home/bill/oracledata/TBS_REPORT_DATA DATAFILE.bdf

      /home/bill/oracledata/TBS_REPORT_IDX.dbf

      /home/bill/oracledata/TBS_REPORT_TMP.dbf

(2) 由于表空间文件用于测试环境,优先启动数据库是最主要的,暂不考虑表空间文件的恢复

      把这三个文件offline再启动Oracle数据库:

      alter database datafile '/home/bill/oracledata/TBS_REPORT_DATA DATAFILE.bdf' offline drop;

      alter database datafile '/home/bill/oracledata/TBS_REPORT_IDX.dbf' offline drop; or

alter database datafile '/home/bill/oracledata/TBS_REPORT_IDX.dbf' offline;

      alter database datafile '/home/bill/oracledata/TBS_REPORT_TMP.dbf' offline;

(3) 在offline TMP表空间时失败

      报下面的错误ORA-01516: nonexistent log file, datafile, or tempfile

      尝试使用如下命令成功:alter database tempfile '/home/bill/oracledata/TBS_REPORT_TMP.dbf' drop including datafiles;     

(4) 启动Oracle数据库

      SQL> alter database open;

                 Database altered.

(5) 删除损坏的表空间文件成功

      drop tablespace TBS_REPORT_IDX including CONTENTS and datafiles;

      drop tablespace TBS_REPORT_TMP including CONTENTS and datafiles;

      drop tablespace TBS_REPORT_DATA including CONTENTS and datafiles;

(6) 重启Oracle数据库成功,问题解决

      SQL>shutdown immediate;

      SQL>startup;

你可能感兴趣的:(oracle,sql,数据库,report,File,database)