现象描述
数据库所在机器异常断电导致启动失败,系统显示如下错误信息:
ORA-00214: control file '/opt/oracle/db/oradata/iptvmdn/lv_control2tbs' version
117553 inconsistent with file '/opt/oracle/db/oradata/iptvmdn/lv_control1tbs'
可能原因
异常断电导使undo表空间文件损坏,数据库启动失败。
处理步骤
% sqlplus / as sysdba
SQL> create pfile=’$ORACLE_HOME/dbs/temp_pfile_ora’ from spfile;
SQL> quit
% vi $ORACLE_HOME/dbs/temp_pfile_ora
在此文件最后添加*.undo_management=‘MANUAL’。
注:在MANUAL模式无法切换undo表空间。
% sqlplus / as sysdba
SQL> startup pfile=$ORACLE_HOME/dbs/temp_pfile_ora;
如果还是无法启动数据库,可以将表空间文件offline。
数据库启动成功,显示如下信息。
ORACLE instance started.
Total System Global Area 4142166016 bytes
Fixed Size 2166208 bytes
Variable Size 2214593088 bytes
Database Buffers 1912602624 bytes
Redo Buffers 12804096 bytes
Database mounted.
Database opened.
SQL> select SEGMENT_NAME from dba_rollback_segs;
SQL> shutdown immediate;
_corrupted_rollback_segments=(_SYSSMU1_1192403689$,_SYSSMU2_1192403689$,_SYSSMU3_1192403689$,_SYSSMU4_1192403689$,_SYSSMU5_1192403689$,_SYSSMU6_1192403689$,_SYSSMU7_1192403689$,_SYSSMU8_1192403689$,_SYSSMU9_1192403689$,_SYSSMU10_1192403689$)
括号中的内容为8中的查询结果。
SQL> startup pfile=$ORACLE_HOME/dbs/temp_pfile_ora;
启动成功,系统显示如下信息:
ORACLE instance started.
Total System Global Area 4142166016 bytes
Fixed Size 2166208 bytes
Variable Size 2214593088 bytes
Database Buffers 1912602624 bytes
Redo Buffers 12804096 bytes
Database mounted.
Database opened.
SQL> CREATE UNDO TABLESPACE undotbs02 DATAFILE ‘/var/tmp/cssd_mdn/myundo.dbf' SIZE 2G;
SQL> alter system set undo_tablespace = undotbs2;
SQL> drop tablespace UNDOTBS1 including contents cascade constraints;
SQL> CREATE UNDO TABLESPACE undotbs01 DATAFILE ‘/dev/oramdn_dg/lv_undotbs’ size 9G;
SQL> autoextentd off;
SQL> alter system set undo_tablespace = UNDOTBS1;
SQL> shutdown immediate;
SQL> startup
启动成功,系统显示如下信息:
OORACLE instance started.
Total System Global Area 4142166016 bytes
Fixed Size 2166208 bytes
Variable Size 2214593088 bytes
Database Buffers 1912602624 bytes
Redo Buffers 12804096 bytes
Database mounted.
Database opened.
建议与总结
Oralce数据库尽量不要强行断电。控制文件、参数文件一定要做好备份。