教你如何重建Oracle数据库的回滚段

1、将数据关闭


svrmgrl >Shutdown abort


2、修改初始化参数文件


$ vi  $ORACLE_HOME/dbs/init< sid >.ora


添加以下参数


rollback_segments=(system)
_corrupted_rollback_segments=(r01,r02,r03,r04)
_allow_resetlogs_corruption=ture


3、重新装载数据库


svrmgrl >Startup mount


4、从数据库的控制文件中将回滚段表空间rbs的数据文件离线并去掉。


svrmgrl >alter database datafile
‘##/##/rbs01.dbf’ offline drop;


---- 对数据库进行恢复。


svrmgrl >recover database using backup controlfile;


---- 此时屏幕上可能会出现:


ORA_00280 Change #### for thread# is in sequence#
specify log:[< RET > for suggested|AUTO|from logsource|cancel]


输入 cancel(不要输入其他命令)


svrmgrl >alter database open resetlogs;


5、 重建新的回滚段


---- 将旧回滚段及回滚表空间删除。  
svrmgrl >alter rollback_segment r01 offline drop;
svrmgrl >alter rollback_segment r02 offline drop;
svrmgrl >alter rollback_segment r03 offline drop;
svrmgrl >alter rollback_segment r04 offline drop;
svrmgrl >drop tablespace rbs including contents;
---- 重建新的回滚表空间及回滚段。  
svrmgrl >connect internal
svrmgrl >create rollback segment ro tablespace system;
svrmgrl >alter rollback segment ro online;
svrmgrl >create tablespace rbs datafile  
##/##/rbs01.dbf’ size ##k;
svrmgrl >create rollback segment r01 tablespace rbs;
svrmgrl >create rollback segment r02 tablespace rbs;
svrmgrl >create rollback segment r03 tablespace rbs;
svrmgrl >create rollback segment r04 tablespace rbs;
svrmgrl >alter rollback segment r01 online;
svrmgrl >alter rollback segment r02 online;
svrmgrl >alter rollback segment r03 online;
svrmgrl >alter rollback segment r04 online;

  
svrmgrl >Shutdown abort
$  vi  $ORACLE_HOME/dbs/init< sid >.ora
  rollback_segments=(r01,r02,r03,r04)
  将参数_corrupted_rollback_segment
        _allow_resetlogs_corruption=true去掉
svrmgrl >Startup normal