Oracle undo表空间损坏的修复(转)
来自:http://blog.csdn.net/cockcrow/archive/2006/02/14/598703.aspx
环境:
windows 2003
oracle 9.2.0.1
noarchivelog
故障行为:
数据库运行时,直接拔电导致无法启动。
我把他发来的数据库文件在本地建了个库,然后启动,检查故障信息。
C:\>sqlplus /nolog
SQL*Plus: Release 9.2.0.1.0 - Production on Tue Feb 14 13:49:00 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys/manager as sysdba
Connected.
SQL> startup pfile='d:\oracle92\ora92\database\inittest.ora'
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup pfile='d:\oracle92\ora92\database\inittest.ora'
ORACLE instance started.
Total System Global Area 93395628 bytes
Fixed Size 453292 bytes
Variable Size 75497472 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
SQL>
查看alert log:
Beginning crash recovery of 1 threads
Tue Feb 14 13:50:53 2006
Started recovery at
Thread 1: logseq 368, block 1462, scn 0.0
Recovery of Online Redo Log: Thread 1 Group 1 Seq 368 Reading mem 0
Mem# 0 errs 0: D:\ORACLE92\ORADATA\TEST\REDO01.LOG
***
Corrupt block relative dba: 0x0080000e (file 2, block 14)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x0080000e
last change scn: 0x0000.0646b03b seq: 0x3 flg: 0x04
consistency value in tail: 0xec0b0203
check value in block header: 0x2790, computed block checksum: 0x7ca0
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0080000e (file 2, block 14) found same corrupted data
***
Corrupt block relative dba: 0x0080078e (file 2, block 1934)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x0080078e
last change scn: 0x0000.064a39c9 seq: 0x1 flg: 0x04
consistency value in tail: 0xac2e0201
check value in block header: 0x23b8, computed block checksum: 0xf3e9
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0080078e (file 2, block 1934) found same corrupted data
***
Corrupt block relative dba: 0x008005ee (file 2, block 1518)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x008005ee
last change scn: 0x0000.064a43e1 seq: 0x3 flg: 0x04
consistency value in tail: 0x49c30201
check value in block header: 0x96f7, computed block checksum: 0x1bab
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x008005ee (file 2, block 1518) found same corrupted data
***
Corrupt block relative dba: 0x0080056e (file 2, block 1390)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x0080056e
last change scn: 0x0000.064a3e68 seq: 0x1 flg: 0x04
consistency value in tail: 0x4c190203
check value in block header: 0x4470, computed block checksum: 0x6a36
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0080056e (file 2, block 1390) found same corrupted data
***
Corrupt block relative dba: 0x0080066e (file 2, block 1646)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x0080066e
last change scn: 0x0000.064a4549 seq: 0x1 flg: 0x04
consistency value in tail: 0x4c2b0201
check value in block header: 0x8a18, computed block checksum: 0x195d
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0080066e (file 2, block 1646) found same corrupted data
***
Corrupt block relative dba: 0x0080047e (file 2, block 1150)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x0080047e
last change scn: 0x0000.064a58ff seq: 0x1 flg: 0x04
consistency value in tail: 0x90e50201
check value in block header: 0xd69c, computed block checksum: 0x4bbd
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0080047e (file 2, block 1150) found same corrupted data
***
Corrupt block relative dba: 0x008003fe (file 2, block 1022)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x008003fe
last change scn: 0x0000.064a56b3 seq: 0x1 flg: 0x04
consistency value in tail: 0x8ff30203
check value in block header: 0x9d2b, computed block checksum: 0x7280
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x008003fe (file 2, block 1022) found same corrupted data
***
Corrupt block relative dba: 0x0080027e (file 2, block 638)
Fractured block found during media/instance recovery
Data in bad block -
type: 2 format: 2 rdba: 0x0080027e
last change scn: 0x0000.064a5231 seq: 0x3 flg: 0x04
consistency value in tail: 0x90f90201
check value in block header: 0x2282, computed block checksum: 0x7a6c
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
Reread of rdba: 0x0080027e (file 2, block 638) found same corrupted data
Tue Feb 14 13:50:57 2006
Ended recovery at
Thread 1: logseq 368, block 55848, scn 0.105557616
817 data blocks read, 122 data blocks written, 54386 redo blocks read
Crash recovery completed successfully
Tue Feb 14 13:50:58 2006
Thread 1 advanced to log sequence 369
Thread 1 opened at log sequence 369
Current log# 2 seq# 369 mem# 0: D:\ORACLE92\ORADATA\TEST\REDO02.LOG
Successful open of redo thread 1.
Tue Feb 14 13:50:59 2006
SMON: enabling cache recovery
Tue Feb 14 13:51:00 2006
Errors in file d:\oracle92\admin\test\udump\db01gen_ora_1888.trc:
ORA-00600: internal error code, arguments: [2662], [0], [105557623], [0], [105590063], [8388633], [], []
Tue Feb 14 13:51:01 2006
Errors in file d:\oracle92\admin\test\udump\db01gen_ora_1888.trc:
ORA-00600: internal error code, arguments: [2662], [0], [105557623], [0], [105590063], [8388633], [], []
Tue Feb 14 13:51:01 2006
Error 600 happened during db open, shutting down database
USER: terminating instance due to error 600
Instance terminated by USER, pid = 1888
ORA-1092 signalled during: ALTER DATABASE OPEN...
Tue Feb 14 13:56:02 2006
USER: terminating instance due to error 1092
Instance terminated by USER, pid = 1888
可知是文件2发生错误,进而导致600错误。
因此,先查看文件2的名字,如下:
SQL> connect sys/manager as sysdba
Connected to an idle instance.
SQL> startup mount pfile='d:\oracle92\ora92\database\inittest.ora'
ORACLE instance started.
Total System Global Area 93395628 bytes
Fixed Size 453292 bytes
Variable Size 75497472 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> select file#,status,name from v$datafile;
FILE# STATUS
---------- -------
NAME
--------------------------------------------------------------------------------
1 SYSTEM
D:\ORACLE92\ORADATA\TEST\SYSTEM01.DBF
2 ONLINE
D:\ORACLE92\ORADATA\TEST\UNDOTBS01.DBF
3 ONLINE
D:\ORACLE92\ORADATA\TEST\CWMLITE01.DBF
FILE# STATUS
---------- -------
NAME
--------------------------------------------------------------------------------
4 ONLINE
D:\ORACLE92\ORADATA\TEST\DRSYS01.DBF
5 ONLINE
D:\ORACLE92\ORADATA\TEST\EXAMPLE01.DBF
6 ONLINE
D:\ORACLE92\ORADATA\TEST\INDX01.DBF
FILE# STATUS
---------- -------
NAME
--------------------------------------------------------------------------------
7 ONLINE
D:\ORACLE92\ORADATA\TEST\ODM01.DBF
8 ONLINE
D:\ORACLE92\ORADATA\TEST\TOOLS01.DBF
9 ONLINE
D:\ORACLE92\ORADATA\TEST\USERS01.DBF
FILE# STATUS
---------- -------
NAME
--------------------------------------------------------------------------------
10 ONLINE
D:\ORACLE92\ORADATA\TEST\XDB01.DBF
11 ONLINE
D:\ORACLE92\ORADATA\TEST\PMS.ORA
12 ONLINE
D:\ORACLE92\ORADATA\TEST\FYBX.ORA
12 rows selected.
可以看到,损坏的文件2是undotbs01.dbf,
查看资料,undotbs损坏或丢失时可以采用隐含参数临时启动数据库,然后进行修复。
修改init文件,加入
*._allow_resetlogs_corruption=true
(注:允许在数据库文件SCN不一致的情况下启动数据库)
*._corrupted_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,_SYSSMU4$,_SYSSMU5$,_SYSSMU6$,_SYSSMU7$,_SYSSMU8$,_SYSSMU9$,_SYSSMU10$)
(注:允许在rollback segments损坏的情况下启动数据库)
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup pfile='d:\oracle92\ora92\database\inittest.ora'
ORACLE instance started.
Total System Global Area 93395628 bytes
Fixed Size 453292 bytes
Variable Size 75497472 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
启动成功,查看下当前的rollback segments
SQL> select segment_name,status from dba_rollback_segs;
SEGMENT_NAME STATUS
------------------------------ ----------------
SYSTEM ONLINE
_SYSSMU1$ NEEDS RECOVERY
_SYSSMU2$ NEEDS RECOVERY
_SYSSMU3$ NEEDS RECOVERY
_SYSSMU4$ NEEDS RECOVERY
_SYSSMU5$ NEEDS RECOVERY
_SYSSMU6$ NEEDS RECOVERY
_SYSSMU7$ NEEDS RECOVERY
_SYSSMU8$ NEEDS RECOVERY
_SYSSMU9$ NEEDS RECOVERY
_SYSSMU10$ NEEDS RECOVERY
SEGMENT_NAME STATUS
------------------------------ ----------------
_SYSSMU11$ ONLINE
12 rows selected.
新建一重做表空间undo
SQL> create undo tablespace undo datafile 'D:\oracle92\oradata\test\undo01.dbf' size 50M reuse autoe
xtend on;
Tablespace created.
SQL> select segment_name,status from dba_rollback_segs;
SEGMENT_NAME STATUS
------------------------------ ----------------
SYSTEM ONLINE
_SYSSMU1$ OFFLINE
_SYSSMU2$ NEEDS RECOVERY
_SYSSMU3$ NEEDS RECOVERY
_SYSSMU4$ NEEDS RECOVERY
_SYSSMU5$ NEEDS RECOVERY
_SYSSMU6$ NEEDS RECOVERY
_SYSSMU7$ NEEDS RECOVERY
_SYSSMU8$ NEEDS RECOVERY
_SYSSMU9$ NEEDS RECOVERY
_SYSSMU10$ NEEDS RECOVERY
SEGMENT_NAME STATUS
------------------------------ ----------------
_SYSSMU11$ ONLINE
_SYSSMU12$ OFFLINE
_SYSSMU13$ OFFLINE
_SYSSMU14$ OFFLINE
_SYSSMU15$ OFFLINE
_SYSSMU16$ OFFLINE
_SYSSMU17$ OFFLINE
_SYSSMU18$ OFFLINE
_SYSSMU19$ OFFLINE
_SYSSMU20$ OFFLINE
_SYSSMU21$ OFFLINE
22 rows selected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
修改init文件
*.undo_tablespace=undo
SQL> startup pfile='d:\oracle92\ora92\database\inittest.ora'
ORACLE instance started.
Total System Global Area 93395628 bytes
Fixed Size 453292 bytes
Variable Size 75497472 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
删除损坏的undotbs1表空间:
SQL> alter tablespace undotbs1 offline normal;
Tablespace altered.
SQL> drop tablespace UNDOTBS1 including contents and datafiles;
Tablespace dropped.
SQL> select * from v$recover_file;
no rows selected
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
修改init文件,注释参数
#*._allow_resetlogs_corruption=true
#*._corrupted_rollback_segments=(_SYSSMU1$,_SYSSMU2$,_SYSSMU3$,_SYSSMU4$,_SYSSMU5$,_SYSSMU6$,_SYSSMU7$,_SYSSMU8$,_SYSSMU9$,_SYSSMU10$)
SQL> startup pfile='d:\oracle92\ora92\database\inittest.ora'
ORACLE instance started.
Total System Global Area 93395628 bytes
Fixed Size 453292 bytes
Variable Size 75497472 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL>
至此数据库已经成功修复。
**********************************************************************************
需要提醒的是,在删除损坏的重做表空间时,一定要先offline,
否则注释掉隐含参数后就会出现下面的情况。
SQL> startup pfile='d:\oracle92\ora92\database\inittest.ora'
ORACLE instance started.
Total System Global Area 93395628 bytes
Fixed Size 453292 bytes
Variable Size 75497472 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
查看alert log,本例中会发现下面的信息,oracle标记刚才删除的
重做表空间需要恢复,这时就无法去掉隐含参数了。
......
drop tablespace UNDOTBS1 including contents and datafiles
SMON: about to recover undo segment 6
SMON: mark undo segment 6 as needs recovery
SMON: about to recover undo segment 6
SMON: mark undo segment 6 as needs recovery
SMON: about to recover undo segment 6
SMON: mark undo segment 6 as needs recovery
......
相关推荐
在Oracle数据库管理中,Undo表空间是至关重要的组成部分,它用于存储事务的回滚信息,以便在发生错误或需要撤销操作时恢复数据。当遇到如ORA-600 [4194]这样的内部错误时,可能是因为Redo记录与Undo记录之间的不匹配...
为应对数据块损坏,Oracle数据库提供了多种机制来预防和检测数据块的损坏,以及在数据块损坏发生后的修复手段。 首先,我们需要了解Oracle数据块的基本概念。Oracle数据块是Oracle数据库中最小的I/O单位,同时也是...
- 为消除回滚段中的活动事务,需要在 pfile 中配置手动 undo 管理,设置 undo_retention 为一个较短的时间,指定新的 undo 表空间,并标记已损坏的回滚段。 总结,Oracle 10g 数据库在遭遇意外断电时,可能需要一...
Undo表空间的使用情况对于了解事务处理和回滚能力非常重要。使用以下命令来查询: ```sql SELECT tbs.name, pct_used, pct_free FROM (SELECT tablespace_name name, (100 * SUM(bytes) / SUM(decode(maxbytes, 0, ...
- **监控和管理Undo表空间**:确保有足够的空间用于Flashback操作,并定期清理不再需要的Undo数据。 - **设置合适的Flash Recovery Area大小**:根据数据库活动和保留时间来设定,以存储足够的日志信息。 - **正确...
这部分可能会讲解如何管理和配置UNDO表空间。 ### 22. 初始化参数 (Initialization Parameter) 初始化参数控制着Oracle实例的行为。这部分内容可能会讲解如何查看和调整各种初始化参数。 ### 23. 备份 (Backup) ...
它利用 Oracle 的多版本读一致性特性,通过 undo 机制提供所需的前镜像中的数据。用户可以通过指定时间点或 SCN 检索需要的数据,从而进行历史数据的查看和修复。 Flashback Query 的工作原理是基于 Oracle 的多...
这些功能基于Oracle的重做日志(Redo Log)和 undo 表空间,它们记录了对数据库的所有更改历史。 1. **闪回查询**:此功能可以让我们查看数据库在特定时间点的状态,就像时光倒流一样。通过使用`SELECT ... AS OF ...
在Oracle数据库中,有时会遇到因redo日志损坏或丢失,无法正常打开数据库的情况。此时,可以利用隐含参数或设置特定的event事件来强制数据库启动。这些方法包括但不限于: 1. 设置隐含参数`_allow_resetlogs_...
总结来说,Oracle数据库的恢复涉及到对错误日志的深入理解,识别错误类型,以及采取适当的恢复步骤,如屏蔽回滚段、重建撤销表空间,甚至可能涉及物理数据块的修复。这个案例提醒我们,定期备份和维护良好的灾难恢复...
在没有备份的情况下,如果UNDO表空间的数据仍然可用,可能可以通过分析UNDO信息来恢复部分数据。 另外,当数据库出现物理损坏,如数据块损坏,Oracle提供了各种检查和修复工具。例如,通过`DBMS_REPAIR`包或者使用`...
Oracle闪回技术是Oracle数据库中一项非常重要的特性,它主要用于逻辑错误的恢复,而非物理损坏的修复。这项技术可以帮助数据库管理员在遇到逻辑错误的情况下,比如误删数据或者更新错误等,能够迅速地恢复到错误发生...
Oracle BBED 是一款用于直接操作Oracle数据库数据文件的低级别数据修复工具,它允许数据库管理员在块级对数据进行查看、修改和验证。BBED 主要适用于Linux 32位平台上的Oracle 10g及11g数据库,特别是在应对数据库坏...
- 管理表空间包括创建、扩展和缩减等操作,以满足不同阶段的数据存储需求。 - **撤销空间管理**: - 撤销空间用于存储事务处理过程中生成的临时数据。 - 合理配置撤销空间大小可以优化查询性能和减少撤销数据的...
然而,这些功能需要启用归档模式和足够的 undo 表空间。 在实施自动备份和恢复策略时,还需要考虑备份的存储位置和生命周期管理。备份应保存在可靠的介质上,如磁带、网络存储或云存储,并根据业务需求设定备份的...
- 可以考虑删除回滚段所在表空间,并取消 UNDO 事务。 ##### 1.4 ORA-0165x - **特征**: - 表空间没有足够的空间供分配。 - **原因**: - 表空间已满。 - 存储参数不合理,比如 `NEXT` 参数设置过小。 - 表...
回滚表空间是Oracle闪回技术的基础,用于存储事务修改数据前的原始状态。当一个事务对数据进行更改时,这些更改的信息会被记录在回滚段中。通过闪回查询,可以查看到数据在特定时间点的状态,甚至可以恢复到某个点...