使用dul恢复数据(转载)

it2024-10-30  13

背景:windows2000上的9201库,一个文件损坏,没有备份,需要用dul抽取数据。

操作步骤:

首先创建2个配置文件:init.dul 和 control.dulinit.dul 是dul工具的参数文件,dul启动的时候要读取这些参数进行配置。control.dul 记录所有数据文件的位置和编号,dul要通过这个文件找到数据文件。

init.dul的内容(不同情况不同版本的库内容不一样):osd_big_endian_flag=falseosd_dba_file_bits=10osd_c_struct_alignment=32osd_file_leader_size=1osd_word_size=32

control_file=Y:DUL20070115_contentinfocontrol.duldb_block_size=8192compatible=9

这里的db_block_size参数要和要恢复的表空间块大小一致。compatible参数要和数据库的compatible参数一致,9i的库要设成9。

control.dul文件的内容用如下sql生成:select ts#, rfile#, name from v$datafile;将查询出来的内容复制到control.dul文件中即可。0 1 Y:ORADATASYSTEM01.DBF1 2 Y:ORADATAUNDOTBS01.DBF3 3 Y:ORADATADRSYS01.DBF4 4 Y:ORADATAINDX01.DBF5 5 Y:ORADATATOOLS01.DBF6 6 Y:ORADATAUSERS01.DBF7 7 Y:ORADATAMDB.ORA9 8 Y:ORADATAXSDBTEST.ORA10 9 Y:ORADATATEST.ORA11 10 Y:ORADATABBS.ORA8 11 Y:ORADATAXSDB.ORA13 12 Y:ORADATAGBMDB.ORA

这2个配置文件要和dul.exe在同一个目录下。创建好之后就可以dul了。

直接在cmd中敲dul进入dul。进入dul以后,先运行bootstrap命令。这是创建部分数据字典:OBJ$ TAB$ COL$ USER$因为oracle的数据块中存储的是纯数据,也就是不包含字段名,表名这些信息,这些信息是存放到数据字典中的。所以dul要先从数据字典中读出这些信息,按照数据字典中的名称以及表的物理信息到数据文件中找到对应的表。

这是dul日志的一部分,表的物理信息都记录在tab$中,dul通过这些信息就能找到表的数据:unload table TAB$( OBJ# number, DATAOBJ# number,TS# number, FILE# number, BLOCK# number,建立好数据字典之后,就可以dul了,有几种模式,比较常用的是按表dul和按用户dul。unload table usera.tablea;unload user usera;

自己的感受:有了dul,介质损坏不再可怕,dba不再担心下岗,生活也变的美好,公鸡也会下蛋了。呵呵!

以下是本次数据恢复时dul的日志,包括了bootstrap和unload user 的过程:

DUL version 9.2.1.5 with 64-bits i/o

Init.dul parameter settings:ALLOW_TRAILER_MISMATCH = FALSEALLOW_DBA_MISMATCH = FALSEASCII2EBCDIC = FALSEBUFFER = 65536COMPATIBLE = 9CONTROL_FILE = Y:DUL20070115control.dulDB_BLOCK_SIZE = 8192DC_COLUMNS = 100000DC_FILES = 1022DC_OBJECTS = 40000DC_TABLES = 10000DC_USERS = 1000DC_SEGMENTS = 10000DC_EXTENTS = 10000CACHE_HEADER_DUMP_LEVEL = 2TX_HEADER_DUMP_LEVEL = 1DATA_HEADER_DUMP_LEVEL = 1ROWDATA_DUMP_LEVEL = 2EXPORT_MODE = trueFILE = dumpFILE_SIZE_IN_MB = LDR_ENCLOSE_CHAR = "LDR_PHYS_REC_SIZE = 0LOGFILE = dul.logMAX_OPEN_FILES = 8OSD_BIG_ENDIAN_FLAG = falseOSD_DBA_FILE_BITS = 10OSD_FILE_LEADER_SIZE = 1OSD_C_STRUCT_ALIGNMENT = 32OSD_WORD_SIZE = 32PARSE_HEX_ESCAPES = FALSEUSE_SCANNED_EXTENT_MAP = FALSETRACE_FLAGS = 0WARN_RECREATE_FILES = TRUEWRITABLE_DATA_FILES = FALSE

Entries from control file Y:DUL20070115control.dul:0 1 Y:ORADATASYSTEM01.DBF startblock 1 block size 8192 (off512=16)1 2 Y:ORADATAUNDOTBS01.DBF startblock 1 block size 8192 (off512=16)3 3 Y:ORADATADRSYS01.DBF startblock 1 block size 8192 (off512=16)4 4 Y:ORADATAINDX01.DBF startblock 1 block size 8192 (off512=16)5 5 Y:ORADATATOOLS01.DBF startblock 1 block size 8192 (off512=16)6 6 Y:ORADATAUSERS01.DBF startblock 1 block size 8192 (off512=16)7 7 Y:ORADATAMDB.ORA startblock 1 block size 8192 (off512=16)9 8 Y:ORADATAXSDBTEST.ORA startblock 1 block size 8192 (off512=16)10 9 Y:ORADATATEST.ORA startblock 1 block size 8192 (off512=16)11 10 Y:ORADATABBS.ORA startblock 1 block size 8192 (off512=16)8 11 Y:ORADATAXSDB.ORA startblock 1 block size 8192 (off512=16)13 12 Y:ORADATAGBMDB.ORA startblock 1 block size 8192 (off512=16)

DUL> bootstrap;Scanning SYSTEM tablespace to locate compatibility segment ...tablespace 0, data file 1: 319999 blocks scannedLoaded 1355 entries from EXT.datSorted 1355 entriesLoaded 1051 entries from SEG.datLoaded 1 entries from COMPATSEG.datCompatibility segment found at file = 1, block = 417database version 9 bootstrap$ at file 1, block 377. unloading table BOOTSTRAP$ 57 rows unloadedLoaded 57 entries from BOOTSTRAP.datParsing Bootstrap$ contentsGenerating dict.ddl for version 9OBJ$: segobjno 18, file 1TAB$: segobjno 2, tabno 1, file 1COL$: segobjno 2, tabno 5, file 1USER$: segobjno 10, tabno 1, file 1Running generated file "@dict.ddl" to unload the dictionary tablesREM DDL Script to unload the dictionary cache for DUL

REM force the settings to get the expected DUL self readable formatalter session set profile DUL_READABLE_FORMAT;

unload table OBJ$( OBJ# number, DATAOBJ# number, OWNER# number,NAME varchar2(30), NAMESPACE ignore, SUBNAME varchar2(30),TYPE# number)storage( segobjno 18 file 1);. unloading table OBJ$ 28155 rows unloaded

unload table TAB$( OBJ# number, DATAOBJ# number,TS# number, FILE# number, BLOCK# number,BOBJ# number, TAB# number, COLS number, CLUCOLS number,PCTFREE$ ignore, PCTUSED$ ignore, INITRANS ignore, MAXTRANS ignore,FLAGS ignore, AUDIT$ ignore, ROWCNT ignore, BLKCNT ignore,EMPCNT ignore, AVGSPC ignore, CHNCNT ignore, AVGRLN ignore,AVGSPC_FLB ignore, FLBCNT ignore,ANALYZETIME ignore, SAMPLESIZE ignore,DEGREE ignore, INSTANCES ignore,INTCOLS ignore, KERNELCOLS ignore, PROPERTY number)cluster C_OBJ#(OBJ#)storage ( segobjno 2 tabno 1 file 1);. unloading table TAB$ 1010 rows unloaded

unload table COL$ ( OBJ# number, COL# number , SEGCOL# number,SEGCOLLENGTH ignore, OFFSET ignore, NAME char(30),TYPE# number, LENGTH number, FIXEDSTORAGE ignore,PRECISION# ignore, SCALE ignore, NULL$ ignore, DEFLENGTH ignore,DEFAULT$ ignore, INTCOL# number, PROPERTY number)cluster C_OBJ#(OBJ#)storage(segobjno 2 tabno 5 file 1);. unloading table COL$ 34136 rows unloaded

unload table USER$( USER# number, NAME varchar2(30))cluster C_USER#(USER#)storage( segobjno 10 tabno 1 file 1);. unloading table USER$ 45 rows unloaded

REM restore the user settingsalter session set profile USER;REM load the files into the cachereload;Loaded 45 entries from USER.datLoaded 28155 entries from OBJ.datLoaded 1010 entries from TAB.datLoaded 34136 entries from COL.datLoaded 1051 entries from SEG.datLoaded 1355 entries from EXT.datSorted 1355 entriesLoaded 1 entries from COMPATSEG.datLoaded 57 entries from BOOTSTRAP.datDUL: Warning: Recreating file "dict.ddl"Generating dict.ddl for version 9OBJ$: segobjno 18, file 1TAB$: segobjno 2, tabno 1, file 1COL$: segobjno 2, tabno 5, file 1USER$: segobjno 10, tabno 1, file 1TABPART$: segobjno 230, file 1TABCOMPART$: segobjno 249, file 1TABSUBPART$: segobjno 240, file 1IND$: segobjno 2, tabno 3, file 1ICOL$: segobjno 2, tabno 4, file 1LOB$: segobjno 2, tabno 6, file 1Running generated file "@dict.ddl" to unload the dictionary tablesREM DDL Script to unload the dictionary cache for DUL

REM force the settings to get the expected DUL self readable formatalter session set profile DUL_READABLE_FORMAT;

unload table OBJ$( OBJ# number, DATAOBJ# number, OWNER# number,NAME varchar2(30), NAMESPACE ignore, SUBNAME varchar2(30),TYPE# number)storage( segobjno 18 file 1);. unloading table OBJ$DUL: Warning: Recreating file "OBJ.ctl"28155 rows unloaded

unload table TAB$( OBJ# number, DATAOBJ# number,TS# number, FILE# number, BLOCK# number,BOBJ# number, TAB# number, COLS number, CLUCOLS number,PCTFREE$ ignore, PCTUSED$ ignore, INITRANS ignore, MAXTRANS ignore,FLAGS ignore, AUDIT$ ignore, ROWCNT ignore, BLKCNT ignore,EMPCNT ignore, AVGSPC ignore, CHNCNT ignore, AVGRLN ignore,AVGSPC_FLB ignore, FLBCNT ignore,ANALYZETIME ignore, SAMPLESIZE ignore,DEGREE ignore, INSTANCES ignore,INTCOLS ignore, KERNELCOLS ignore, PROPERTY number)cluster C_OBJ#(OBJ#)storage ( segobjno 2 tabno 1 file 1);. unloading table TAB$DUL: Warning: Recreating file "TAB.ctl"1010 rows unloaded

unload table COL$ ( OBJ# number, COL# number , SEGCOL# number,SEGCOLLENGTH ignore, OFFSET ignore, NAME char(30),TYPE# number, LENGTH number, FIXEDSTORAGE ignore,PRECISION# ignore, SCALE ignore, NULL$ ignore, DEFLENGTH ignore,DEFAULT$ ignore, INTCOL# number, PROPERTY number)cluster C_OBJ#(OBJ#)storage(segobjno 2 tabno 5 file 1);. unloading table COL$DUL: Warning: Recreating file "COL.ctl"34136 rows unloaded

unload table USER$( USER# number, NAME varchar2(30))cluster C_USER#(USER#)storage( segobjno 10 tabno 1 file 1);. unloading table USER$DUL: Warning: Recreating file "USER.ctl"45 rows unloaded

unload table TABPART$( OBJ# number, DATAOBJ# number, BO# number,PART# number, HIBOUNDLEN ignore, SPARE3 ignore,TS# number, FILE# number, BLOCK# number)storage( segobjno 230 file 1);. unloading table TABPART$ 37 rows unloaded

unload table TABCOMPART$( OBJ# number, DATAOBJ# ignore, BO# number,PART# number)storage( segobjno 249 file 1);. unloading table TABCOMPART$ 0 rows unloaded

unload table TABSUBPART$( OBJ# number, DATAOBJ# number, POBJ# number,SUBPART# number, FLAGS ignore,TS# number, FILE# number, BLOCK# number)storage( segobjno 240 file 1);. unloading table TABSUBPART$ 0 rows unloaded

unload table IND$( BO# number, OBJ# number,DATAOBJ# number, TS# number, FILE# number, BLOCK# number,INDMETHOD# ignore, COLS number, PCTFREE$ ignore, INITRANS ignore,MAXTRANS ignore, PCTTHRESH$ ignore,TYPE# number, FLAGS ignore, PROPERTY number)cluster C_OBJ#(BO#)storage ( segobjno 2 tabno 3 file 1);. unloading table IND$ 1120 rows unloaded

unload table ICOL$( BO# number, OBJ# number, COL# number, POS# number)cluster C_OBJ#(BO#)storage ( segobjno 2 tabno 4 file 1);. unloading table ICOL$ 1707 rows unloaded

unload table LOB$( OBJ# number, COL# number, INTCOL# ignore,lobj# number, part# ignore, ind# number,ts# number, file# number, block# number)cluster C_OBJ#(OBJ#)storage ( segobjno 2 tabno 6 file 1);. unloading table LOB$ 76 rows unloaded

REM restore the user settingsalter session set profile USER;REM load the files into the cachereload;Loaded 45 entries from USER.datLoaded 28155 entries from OBJ.datLoaded 1010 entries from TAB.datLoaded 34136 entries from COL.datLoaded 1051 entries from SEG.datLoaded 1355 entries from EXT.datSorted 1355 entriesLoaded 37 entries from TABPART.datLoaded 0 entries from TABCOMPART.datLoaded 0 entries from TABSUBPART.datLoaded 1120 entries from IND.datLoaded 76 entries from LOB.datLoaded 1707 entries from ICOL.datLoaded 1 entries from COMPATSEG.datLoaded 57 entries from BOOTSTRAP.datDUL> unload user gbmdb2 ;About to unload GBMDB's tables .... unloading table C_XYQUOTATION_CHANGE_BAK 1 row unloaded. unloading table C_BANK 2038 rows unloaded. unloading table C_BEHALF 11182 rows unloaded. unloading table C_CLASS 10 rows unloaded. unloading table C_FSUPPLIER 28 rows unloaded. unloading table C_FSUPPLIER_REGION 39 rows unloaded. unloading table C_MEMB 2012 rows unloaded. unloading table C_MEMBER_SUPPLIER 77 rows unloaded. unloading table C_MPLATE 830 rows unloaded. unloading table C_NODE 34 rows unloaded. unloading table C_ORDER_DEL 350 rows unloaded. unloading table C_ORDER_DEL_LOG 0 rows unloaded. unloading table C_PRODUCT 9171 rows unloaded. unloading table C_PRODUCT_CONTROL 10286 rows unloaded. unloading table C_QUOTAS_LOG 15583 rows unloaded. unloading table C_QUOTATION 272017 rows unloaded. unloading table C_QUOTATIONS 484517 rows unloaded. unloading table C_QUOTATION_LOG 7589 rows unloaded. unloading table C_REGION 60 rows unloaded. unloading table C_SUPPLIER 173 rows unloaded. unloading table C_CONSIGN 863 rows unloaded. unloading table C_XYORDER_DEL 1473 rows unloaded. unloading table C_XYORDER_DEL_LOG 6 rows unloaded. unloading table C_XYQUOTATION 13400 rows unloaded. unloading table C_XYQUOTATIONS 54504 rows unloaded. unloading table C_XYQUOTATIONS_CHANGE 35482 rows unloaded. unloading table C_XYQUOTATION_CHANGE 12670 rows unloaded. unloading table C_XYQUOTATION_CHANGE_LOG 161 rows unloaded. unloading table C_XYQUOTATION_LOG 9 rows unloaded. unloading table PLAN_TABLE 0 rows unloaded. unloading table MQUOTAS 1068 rows unloaded. unloading table AMQUOTAS 331 rows unloaded. unloading table MQUOTASOPR 3240 rows unloaded. unloading table CHARG_RULE 0 rows unloaded. unloading table CODETYPE 16 rows unloaded. unloading table CODEITEM 129 rows unloaded. unloading table C_TO 1016 rows unloaded. unloading table MEMB 2012 rows unloaded. unloading table ROLE 10 rows unloaded. unloading table USERINFO 132 rows unloaded. unloading table ROLERESOLIST 160 rows unloaded. unloading table P_DIRECTOR 51 rows unloaded. unloading table USERROLELIST 139 rows unloaded. unloading table DIRECTOR_MEMB 1143 rows unloaded. unloading table C_QUOTATIONS_BAK 39 rows unloaded. unloading table C_XYQUOTATION_BAK 5964 rows unloaded. unloading table C_XYORDER_DEL_BAK 23 rows unloaded. unloading table MLOG$_MQUOTAS 0 rows unloadedDUL: Error: Skipping temporary table RUPD$_MQUOTAS. unloading table DELI_PRODUCT_VALUE 12861 rows unloaded. unloading table OUT_USERINFO 76 rows unloaded. unloading table PRE_MQUOTAS 715 rows unloaded. unloading table NOTICE 79 rows unloaded. unloading table NEWS 29 rows unloaded. unloading table MQUOTAS_BAK 2425 rows unloaded. unloading table ADVICE 11 rows unloaded. unloading table DELI_PRODUCT 12854 rows unloaded. unloading table MLOG$_DELI_PRODUCT_VALUE 39165 rows unloadedDUL: Error: Skipping temporary table RUPD$_DELI_PRODUCT_VALUE. unloading table REPORTCDT 4 rows unloaded. unloading table DELIREGION 6 rows unloaded. unloading table C_TAX 1299 rows unloaded. unloading table SUPPLY_GOODS 190 rows unloaded. unloading table REQUIRE_GOODS 2266 rows unloaded. unloading table PROVINCE_CITY 31 rows unloaded. unloading table DP 2442 rows unloaded. unloading table ZC_PERM 251134 rows unloaded. unloading table ZC_PERMS 497100 rows unloaded. unloading table MLOG$_C_PRODUCT 69545 rows unloadedDUL: Error: Skipping temporary table RUPD$_C_PRODUCT. unloading table MLOG$_C_PRODUCT_CONTROL 32548 rows unloadedDUL: Error: Skipping temporary table RUPD$_C_PRODUCT_CONTROL. unloading table C_DELI_PRODUCT 10286 rows unloaded. unloading table MLOG$_C_XYQUOTATIONS 47462 rows unloadedDUL: Error: Skipping temporary table RUPD$_C_XYQUOTATIONS. unloading table MLOG$_C_QUOTATION 715709 rows unloadedDUL: Error: Skipping temporary table RUPD$_C_QUOTATION. unloading table MLOG$_MEMB 9562 rows unloadedDUL: Error: Skipping temporary table RUPD$_MEMB. unloading table DELI_PRODUCT_BAK 5012 rows unloaded. unloading table MLOG$_AMQUOTAS 522 rows unloadedDUL: Error: Skipping temporary table RUPD$_AMQUOTAS. unloading table MEMB_BAK 2011 rows unloaded. unloading table PERMST2 107621 rows unloaded. unloading table BUDGET_B 4120 rows unloaded. unloading table LOG_ZC_PERMS 1160838 rows unloaded. unloading table LOG_ZC_PERM 397771 rows unloaded. unloading table PERMST 107614 rows unloaded. unloading table BUDGET_B_CITY 3785 rows unloaded. unloading table BUDGET_S 0 rows unloaded. unloading table BUDGET_S_CITY 0 rows unloaded. unloading table B_FORECAST 27 rows unloaded. unloading table COLUMNINFO 6 rows unloadedPreparing lob metadata from lob index. unloading (index organized) table LOB030127eb 0 rows unloadedLoaded 0 entries from LOB030127eb.datSorted 0 entries. unloading table CONTENTINFODUL: Error: Column CONTENT of type CLOB cannot be unloaded in export_modeDUL: Warning: Column will be ignored42 rows unloaded. unloading table BO 164 rows unloaded. unloading table SOO 103 rows unloaded. unloading table SO 102 rows unloaded. unloading table C_QUOTALO 617 rows unloaded. unloading table C_QUOTATION_BAK 91 rows unloaded. unloading table C_QUOTAS 1068 rows unloaded. unloading table TEST_QUO 404195 rows unloaded. unloading table TBAG 405649 rows unloaded. unloading table BBAG 405635 rows unloaded. unloading table TTBAG 75721 rows unloadedDUL> exit

Life is DUL without it

转载于:https://www.cnblogs.com/wuhenke/archive/2011/03/14/1984007.html

相关资源:数据结构—成绩单生成器
最新回复(0)