标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 kfed MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (102)
- 数据库 (1,674)
- DB2 (22)
- MySQL (73)
- Oracle (1,536)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (22)
- ORA-xxxxx (159)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (14)
- ORACLE 21C (3)
- Oracle 23ai (7)
- Oracle ASM (67)
- Oracle Bug (8)
- Oracle RAC (52)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (562)
- Oracle安装升级 (92)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (78)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- GoldenGate 19安装和打patch
- dd破坏asm磁盘头恢复
- 删除asmlib磁盘导致磁盘组故障恢复
- Kylin Linux 安装19c
- ORA-600 krse_arc_complete.4
- Oracle 19c 202410补丁(RUs+OJVM)
- ntfs MFT损坏(ntfs文件系统故障)导致oracle异常恢复
- .mkp扩展名oracle数据文件加密恢复
- 清空redo,导致ORA-27048: skgfifi: file header information is invalid
- A_H_README_TO_RECOVER勒索恢复
- 通过alert日志分析客户自行对一个数据库恢复的来龙去脉和点评
- ORA-12514: TNS: 监听进程不能解析在连接描述符中给出的SERVICE_NAME
- ORA-01092 ORA-00604 ORA-01558故障处理
- ORA-65088: database open should be retried
- Oracle 19c异常恢复—ORA-01209/ORA-65088
- ORA-600 16703故障再现
- 数据库启动报ORA-27102 OSD-00026 O/S-Error: (OS 1455)
- .[metro777@cock.li].Elbie勒索病毒加密数据库恢复
- 应用连接错误,初始化mysql数据库恢复
- RAC默认服务配置优先节点
标签归档:segment header坏块
通过rowid获取segment header坏块数据
在上篇(table中各种坏块对select/dml操作影响)中说到如果segment header异常了,不能通过ctas来获得相关数据,在群的讨论中,EZIO说到可以通过rowid方式来获得相关数据,通过测试证明,确实可以通过该方法获得数据,以后遇到此类错误,大家也不必惊慌.
创建测试表
SQL> create table t_xifenfei 2 as 3 select * from dba_objects where object_id is not null; SQL> alter table t_xifenfei 2 add constraint PK_t_xifenfei primary key (object_id) 3 ; Table altered. SQL> alter system checkpoint; System altered. SQL> select count(*) from chf.t_xifenfei; COUNT(*) ---------- 74762 SQL> select header_file,header_block from 2 DBA_SEGments where segment_name='T_XIFENFEI' AND OWNER='CHF'; HEADER_FILE HEADER_BLOCK ----------- ------------ 4 170
dump block
alter system dump datafile 4 block 170; Dump of buffer cache at level 4 for tsn=4 rdba=16777386 Block dump from disk: buffer tsn: 4 rdba: 0x010000aa (4/170) scn: 0x0b8c.3c0092e4 seq: 0x01 flg: 0x04 tail: 0x91e42301 frmt: 0x02 chkval: 0xa531 type: 0x23=PAGETABLE SEGMENT HEADER
通过header_block和dump block确定block 170即为PAGETABLE SEGMENT HEADER
bbed制造SEGMENT HEADER坏块
BBED> set block 170 BLOCK# 170 BBED> set offset 8188 OFFSET 8188 BBED> d File: /u01/oracle/oradata/ora11g/users01.dbf (0) Block: 170 Offsets: 8188 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ 0123e492 <32 bytes per line> BBED> m /x 0123e491 Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y File: /u01/oracle/oradata/ora11g/users01.dbf (0) Block: 170 Offsets: 8188 to 8191 Dba:0x00000000 ------------------------------------------------------------------------ 0123e491 <32 bytes per line> BBED> sum apply Check value for File 0, Block 170: current = 0xa531, required = 0xa531 BBED> verify DBVERIFY - Verification starting FILE = /u01/oracle/oradata/ora11g/users01.dbf BLOCK = 170 Block 170 is corrupt Corrupt block relative dba: 0x010000aa (file 0, block 170) Fractured block found during verification Data in bad block: type: 35 format: 2 rdba: 0x010000aa last change scn: 0x0b8c.3c0092e4 seq: 0x1 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x91e42301 check value in block header: 0xa531 computed block checksum: 0x0 DBVERIFY - Verification complete Total Blocks Examined : 1 Total Blocks Processed (Data) : 0 Total Blocks Failing (Data) : 0 Total Blocks Processed (Index): 0 Total Blocks Failing (Index): 0 Total Blocks Empty : 0 Total Blocks Marked Corrupt : 1 Total Blocks Influx : 2 Message 531 not found; product=RDBMS; facility=BBED
测试segment header坏块后select操作
SQL> select * from chf.t_xifenfei; select * from chf.t_xifenfei * ERROR at line 1: ORA-01578: ORACLE data block corrupted (file # 4, block # 170) ORA-01110: data file 4: '/u01/oracle/oradata/ora11g/users01.dbf' SQL> select /*+index(t PK_T_XIFENFEI)*/ count(rowid) from chf.t_xifenfei t; COUNT(ROWID) ------------ 74762
基于rowid获取segment header 坏块对象数据
SQL> create table chf.bad_rows (table_name varchar2(60), 2 row_id rowid, oracle_error_code number); Table created. SQL> DECLARE 2 TYPE RowIDTab IS TABLE OF ROWID INDEX BY BINARY_INTEGER; 3 CURSOR c1 IS select /*+index(t PK_T_XIFENFEI)*/ rowid from chf.t_xifenfei t; 4 r RowIDTab; 5 rows NATURAL := 20000; 6 bad_rows number := 0 ; 7 errors number; 8 error_code number; 9 myrowid rowid; 10 BEGIN 11 OPEN c1; 12 LOOP 13 FETCH c1 BULK COLLECT INTO r LIMIT rows; 14 EXIT WHEN r.count=0; 15 BEGIN 16 FORALL i IN r.FIRST..r.LAST SAVE EXCEPTIONS 17 insert into chf.t_xifenfei_new 18 select /*+ ROWID(A) */ * 19 from chf.t_xifenfei A where rowid = r(i); 20 EXCEPTION 21 when OTHERS then 22 BEGIN 23 errors := SQL%BULK_EXCEPTIONS.COUNT; 24 FOR err1 IN 1..errors LOOP 25 error_code := SQL%BULK_EXCEPTIONS(err1).ERROR_CODE; 26 myrowid := r(SQL%BULK_EXCEPTIONS(err1).ERROR_INDEX); 27 bad_rows := bad_rows + 1; 28 insert into chf.bad_rows values('chf.t_xifenfei',myrowid, error_code); 29 END LOOP; 30 END; 31 END; 32 commit; 33 END LOOP; 34 commit; 35 CLOSE c1; 36 dbms_output.put_line('Total Bad Rows: '||bad_rows); 37 END; 38 / Total Bad Rows: 0 PL/SQL procedure successfully completed. SQL> select count(*) from chf.t_xifenfei_new; COUNT(*) ---------- 74762
通过上面pl/sql,基于rowid成功获得segment header 异常对象中的所有数据记录.如果没有主键的表出现该问题,可以参考:使用plsql抢救数据