bbed修改undo段状态(ORA-01578)
Linuxidc@orcl11g>select * from Linuxidc;
select * from Linuxidc
*
ERROR at line 1:
ORA-01578: Oracle data block corrupted (file # 3, block # 1449)
ORA-01110: data file 3: '/opt/oracle/oradata/orcl11g/undotbs01.dbf'
这里是事务正在执行,但是数据库直接以abort方式关机,并且对应的回滚段损坏
当然这里其实不需要bbed,只需要用_offline_rollback_segments 隐含参数标记对应的回滚段,然后使用drop rollback segment 该回滚段即可
这里使用bbed目的是在于研究undo回滚段的状态存于何处以及如何修改
这里我们创建另外一个undo表空间,并且切换到该表空间
Linuxidc@orcl11g>create undo tablespace undotbs02 datafile '/opt/oracle/oradata/orcl11g/undotb02.dbf' size 100m;
Tablespace created.
Linuxidc@orcl11g>alter system set undo_tablespace=undotbs02;
System altered.
Linuxidc@orcl11g>show parameter undo
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS02
我们查看回滚段的状态,发现即使切换了,还有一个回滚段处于online状态,因为这个回滚段上面还存在需要恢复的数据,但是这个回滚段已经被损坏,无法进行恢复。那么我们只能将其删除。
Linuxidc@orcl11g>select segment_name,tablespace_name,status from dba_rollback_segs;
SEGMENT_NAME TABLESPACE_NAME STATUS
------------------------------ -------------------- ------------------------------------------------------------
SYSTEM SYSTEM ONLINE
_SYSSMU10_3550978943$ UNDOTBS1 ONLINE
_SYSSMU9_1424341975$ UNDOTBS1 OFFLINE
_SYSSMU8_2012382730$ UNDOTBS1 OFFLINE
_SYSSMU7_3286610060$ UNDOTBS1 OFFLINE
_SYSSMU6_2443381498$ UNDOTBS1 OFFLINE
_SYSSMU5_1527469038$ UNDOTBS1 OFFLINE
_SYSSMU4_1152005954$ UNDOTBS1 OFFLINE
_SYSSMU3_2097677531$ UNDOTBS1 OFFLINE
_SYSSMU2_2232571081$ UNDOTBS1 OFFLINE
_SYSSMU1_3780397527$ UNDOTBS1 OFFLINE
_SYSSMU20_3705739785$ UNDOTBS02 ONLINE
_SYSSMU19_3920348761$ UNDOTBS02 ONLINE
_SYSSMU18_2539622763$ UNDOTBS02 ONLINE
_SYSSMU17_178842559$ UNDOTBS02 ONLINE
_SYSSMU16_3035903491$ UNDOTBS02 ONLINE
_SYSSMU15_444141832$ UNDOTBS02 ONLINE
_SYSSMU14_3021863913$ UNDOTBS02 ONLINE
_SYSSMU13_3717211136$ UNDOTBS02 ONLINE
_SYSSMU12_3182721254$ UNDOTBS02 ONLINE
_SYSSMU11_3909920883$ UNDOTBS02 ONLINE
通过以下可以看到不同的数字对应不同的状态:
undo segment 的状态:
1表示offline并且被删除
2 表示offline
3 表示online
4 未知
5 表示need recovery