oracle中dul無法載入bootstrap實現unload table/user恢複

來源:互聯網
上載者:User

最近有朋友誤操作引起了非常大的事故,差點吃了官司.在做資料庫遷移的時候,遠程誤操作刪除了原庫的system等幾個資料庫初始安裝的檔案,而且該磁碟空間使用率非常高,還有少量寫入.最後結果比較悲劇,通過檔案系統層面無法直接恢複出來資料檔案,而且該庫無任何有效備份,又沒有表名,列名等資訊,無奈之下只能通過底層io block重組來恢複資料檔案,可是悲劇又一次發生,這個磁碟上以前也有一份system等檔案,最後經過多方重組恢複出來一份相對理想的資料檔案.但是第三方公司通過這樣重組出來的資料檔案和未被刪除的業務檔案恢複出來的資料大量有問題,依舊需要我們進一步分析恢複處理.這篇文章主要描述了dul在無法載入bootstrap命令之後通過一些方法依舊可以正常使用unload table/user 等命令實現資料儘可能恢複.你要知道幾百張表沒有表名/列名要把他們區分出來那是什麼樣的工作量……
在dul中配置system檔案
D:\xifenfei\system01.dbf
 
D:\TEMP\recover\dul\bak>dul
 
Data UnLoader: 11.2.0.0.4 - Internal Only - on Wed Sep 28 17:01:56 2016
with 64-bit io functions
 
Copyright (c) 1994 2016 Bernard van Duijnen All rights reserved.
 
 Strictly Oracle Internal Use Only
 
 
DUL> show datafiles;
Sorry, no valid data files found in control.txt
使用預設的dul中資料檔案配置方法,讓dul自己探索資料檔案方法不可行

隨意資料表空間號和檔案號dul識別
0 0 D:\xifenfei\system01.dbf
 
D:\TEMP\recover\dul\bak>dul
 
Data UnLoader: 11.2.0.0.4 - Internal Only - on Wed Sep 28 17:00:27 2016
with 64-bit io functions
 
Copyright (c) 1994 2016 Bernard van Duijnen All rights reserved.
 
 Strictly Oracle Internal Use Only
 
 
 
DUL: Warning: File Type mismatch 1 != 8
DUL: Warning: D:\xifenfei\system01.dbf Header tablespace number 3
!= 0
DUL: Warning: D:\xifenfei\system01.dbf Header relative file number 1 != 0
Found db_id = 2948357999
Found db_name = XIFENFEI
DUL: Warning: Found mismatch while checking file D:\xifenfei\system01.dbf
DUL: Warning: DUL osd_parameter or control.dul configuration error
DUL: Warning: Given file number(0) in control file does not match file# in dba(1)
通過這個識別我們可以知道system的資料表空間號為3,檔案號為1

再次配置system讓dul識別
3 1 D:\xifenfei\system01.dbf
D:\TEMP\recover\dul\bak>dul
 
Data UnLoader: 11.2.0.0.4 - Internal Only - on Wed Sep 28 17:03:46 2016
with 64-bit io functions
 
Copyright (c) 1994 2016 Bernard van Duijnen All rights reserved.
 
 Strictly Oracle Internal Use Only
 
 
 
DUL: Warning: File Type mismatch 1 != 8
Found db_id = 2948357999
Found db_name = XIFENFEI
DUL> show datafiles;
ts# rf# start   blocks offs open  err file name
  3   1     0   320257    0    1    0 D:\xifenfei\system01.dbf
dul正常識別出來system檔案但是根據經驗我們知道tablespace 3肯定是有問題的,因此後續操作依舊問題非常多

嘗試dul bootstrap恢複失敗
DUL> bootstrap;
Scanning SYSTEM tablespace to locate compatibility segment ...
DUL: Warning: No files found for tablespace 0
Reading EXT.dat 0 entries loaded and sorted 0 entries
Reading SEG.dat 0 entries loaded
Reading COMPATSEG.dat 0 entries loaded
Reading SCANNEDLOBPAGE.dat 0 entries loaded and sorted 0 entries
DUL: Error: No compatibility segments found
由於資料表空間號錯誤,dul無法載入到bootstrap$表,另外根據bbed分析恢複出來的system檔案中bootstrap$這部分丟失

嘗試人工載入dul所需資料字典
DUL> unload table OBJ$
  2     storage ( tablespace 3 segobjno 18 file 1 block 240);
. unloading table                      OBJ$   79074 rows unloaded
 
DUL> unload table TAB$( OBJ# number, DATAOBJ# number,
  2      cluster  C_OBJ#(OBJ#)
  3      storage ( tablespace 3 segobjno 2 tabno 1 file 1 block 144);
. unloading table                      TAB$    4482 rows unloaded
 
DUL> unload table COL$ ( OBJ# number, COL# number , SEGCOL# number,
  2      cluster C_OBJ#(OBJ#)
  3      storage ( tablespace 3 segobjno 2 tabno 5 file 1 block 144);
. unloading table                      COL$  114491 rows unloaded
 
DUL> unload table USER$
  2      cluster C_USER#(USER#)
  3      storage ( tablespace 3 segobjno 10 tabno 1 file 1 block 208);
. unloading table                     USER$      96 rows unloaded
 
----其他表省略,根據需要的依次處理
嘗試使用dul恢複資料
DUL> desc portal_emr.BASEELEMENT;
Table PORTAL_EMR.BASEELEMENT
obj#= 87200, dataobj#= 87200, ts#= 9, file#= 7, block#=458
      tab#= 0, segcols= 8, clucols= 0
Column information:
icol# 01 segcol# 01       BENAME len   30 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 02 segcol# 02     TYPENAME len   30 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 03 segcol# 03     TYPETYPE len   22 type  2 NUMBER(0,0)
icol# 04 segcol# 04    BEXMLTEXT len 4000 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 05 segcol# 05 DEPTGROUPCODE len   30 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 06 segcol# 06     ISCOMMON len   22 type  2 NUMBER(0,0)
icol# 07 segcol# 07      BESPELL len   15 type  1 VARCHAR2 cs 852(ZHS16GBK)
icol# 08 segcol# 08     ELEMTYPE len   22 type  2 NUMBER(0)
 
DUL> show datafiles;
ts# rf# start   blocks offs open  err file name
  3   1     0   320257    0    1    0 D:\xifenfei\system01.dbf
  9   7     0  4170425    0    1    0 D:\BaiduYunDownload\PORTAL_EMR
 
DUL> unload table portal_emr.BASEELEMENT;
. unloading table               BASEELEMENT    1913 rows unloaded
這裡描述了在dul無法載入bootstrap命令之後,通過人工載入資料字典實現正常的unload table/user功能,丟棄了一般處理思路中的只能通過scan 然後unload沒有表名,列名的處理方法,從而實現了恢複的最大化.
我們對原廠官方oracle dual工具有深入研究,如果在oracle dul恢複方面有搞不定的問題.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.