您的位置:首页 > 数据库

数据库没有备份无法打开处理方法之二dul

2017-06-10 10:16 369 查看
 由于企业的数据库人员经验不足,或是根本没有dba,因此,可能会出现数据瘫痪,数据库不能打开的现象,但是又没有备份,那么我们一般有两种方法:

 a,数据库强行打开;

 b,使用oracledul工具来把数据抽取出来

一般使用dul都是强行打开数据库都无法打开,或是某个表空间文件无法online的情况下才使用,需要把这个表空间的数据挽救出来。注意此工具需要system表空间是好的。

dul是oracle内部工具,原来没有什么限制,现在有了时间限制为30天,也就是说,如果下载下来使用超过30天,就无法使用了。大家记住这个工具只是为了挽救数据,此工具会把数据库中的表的数据抽取出来,用户中的索引,存储过程,函数,触发器之类的除了表以外的对象不能使用此工具,并且即使表数据抽取出来,表的结构也无法正确抽取出来,比如表结构中一列idnumber(20)notnull,当导入的时候此列只能是idnumber,无法显示number(20),后面的非空也不会有,因此只能说挽救数据。此工具抽取数据生成两种格式的文件,一个是.dmp文件,可以直接使用imp导入,另外一个是sqlldr文件,只能使用sqlldr命令加载进去。那么其他对象怎么才可以获得到,有两个办法:

1.从开发商那里获得到用户的结构,但是不需要数据。

2.把所有文件,除了systemundo以外的其他文件全部offline,然后强行打开。如果这样可以,那么可以把用户结构导出

  expsystem/passwordowner=appuserrows=n

当获得到用户结构后,需要先把空用户导入,也就是除了数据以外的用户的对象导入,然后把外键,触发器disable,然后再把dul导出的数据导入,此时要注意,如果有数据量大的表,必须要先把索引去掉,然后等导入数据后再把索引使用兵法创建的方法创建。

上边的方法最好使用第二种,因为数据库中有sequence,如果使用第一种,有可能sequence在开发商那里很小,但是在生产库很大,我们就遇到过这种情况,如果第二种方法无法实现,只能是用第一种的时候,我们可能就需要认为把sequence的cache手动加大。

  下面摘自oracle文档,对dul进行一个详细说明

 

DUL'sPRINCIPLESandFEATURELIST

STANDALONEC-PROGRAM

DULisastandaloneCprogramthatdirectlyretrievesrowsfromtablesindatafiles.TheOracleRDBMSsoftwareisNOTusedatall.DULdoesdirtyreads,itassumesthateverytransactioniscommitted.Nordoesitcheck/requirethatmediarecoveryhasbeen
done.

LASTRESORT

DULisintendedtoretrievedatathatcannotberetrievedotherwise.ItisNOTanalternativeforEXP,SQL*Plusetc.Itismeanttobealastresort,notfornormalproductionusage.

BeforeyouuseDULyoumustbeawarethattherdbmshasmanyhiddenfeaturestoforceabaddatabaseopen.Undocumentedinit.oraparametersandeventscanbeusedtoskiprollforward,todisablerollback,disablecertainSMONactions,advancethedatabase
scnandmore.

DATABASECORRUPT-BLOCKSOK

Thedatabasecanbecorrupted,butanindividualdatablockusedmustbe100%correct.Duringallunloadingchecksaremadetomakesurethatblocksarenotcorruptedandbelongtothecorrectsegment.Ifduringascanabadblockisencountered,anerrormessage
isprintedintheloaderfileandtostandardoutput.Unloadingwillcontinuewiththenextroworblock.

ROWSinCLUSTERS/TABLES/INDEXES

DULcanandwillonlyunloadindex/table/clusterdata.ItwillNOTdumptriggers,storedproceduresnorcreatesqlscriptsfortablesorviews.(Butthedatadictionarytablesdescribingthemcanbeunloaded).Thedatawillbeunloadedinaformatsuitable
forSQL*LoaderorIMP.AmatchingcontrolfileforSQL*Loaderisgeneratedaswell.

DULcanunloadindicesandindexorganizedtables.Indexunloadisusefulltodeterminehowmanyrowsatableshouldhaveortoidentifythemissingrows.

CROSSPLATFORM UNLOADING

Cross-platformunloadingissupported.ThedatabasecanbecopiedfromadifferentoperatingsystemthantheDUL-host.(Databases/systemsdonesofar:Sequent/ptx,VaxVms,AlphaVms,MVS,HP9000/8xx,IBMAIX,SCOUnix,AlphaOSF/1,IntelWindowsNT).

Theconfigurationparameterswithin"init.dul"willhavetobemodifiedtomatchthoseoftheoriginalplatformandO/Sratherthantheplatformfromwhichtheunloadisbeingdone.

ROBUST

DULwillnotdump,spinorhangnomatterhowbadlycorruptedthedatabaseis.

(NEARLY)ALLORACLEFEATURESSUPPORTED

Fullsupportforalldatabaseconstructs:rowchaining,rowmigration,hash/indexclusters,longs,raws,rowids,dates,numbers,multiplefreelistgroups,segmenthighwatermark,NULLS,trailingNULLcolumns,andunlimitedextents,newblocklayoutofOracle8,
partitionedtables.

Lateradditionsarelobs,compressedindexes,9ir2compressedtables.VarraysandADTs(userdefinedobjects)arepartlysupportedinsql*loadermode.

ASMisfullysupported,filescanbeextractedfromanasmdiskgroup.NomountedASMinstanceisused,thedisksareaccesseddirectly.Nondefaultasmallocationunitsizesaresupported.

Datacanberecoveredfromexportdumpfileswiththeunexpcommandsuite.Someinitialworkhasbeendoneforunpumptosupportdatapumpfiles.

SUPPORTEDRDBMSVERSIONS

DULshouldworkwithallversionsstartingoracle6.DULhasbeentestedwithversionsfrom6.0.26upto10.2.Eventheoldblockheaderlayout(pre6.0.27.2)issupported.

MULTIBYTESUPPORT

DULitselfisessentiallyasinglebyteapplication.Thecommandparserdoesnotunderstandmultibytecharacters,butitispossibletounloadanymultibytedatabase.Forallpossiblecaveatsthereisaworkaround.

DULcanoptionallyconverttoUTF8.ThisisforNCLOBSthatarestoredinUTF16.

RESTRICTIONS

MLSLABELS
MultiLevelSecurityLablesoftrustedoraclearenotsupported.

(LONG)RAW
DULcanunload(long)raws.NowadaysthereissuitableformatinSQL*Loadertopreservealllongraws.SoLongrawsandblobscanbeunloadedinbothmodes.

ORACLE8OBJECTOPTIONANDLOBS
Nestedtablesarenotyetsupported,iftheyareneededletmeknowanditwillbeadded.VarraysandADTsaresupported,alsothosethatarestoredasakernellob.CLOBS,NCLOBSaresupportedbothinSQL*Loadermodeandinexpmode.BLOBSarebesthandled
inexpmode,thegeneratedhexformatinSQL*Loadermodeisnotloadedcorrectlycurrently.

PORTABLE

DULcanbeportedtoanyoperatingsystemwithanANSI-Ccompiler.DULhasbeenportedtomanyUNIXvariants,VMSandWindowsNT.CurrentlyallbuildsaredoneusinggccandacrosscompilerenvironmentonLinux

RDBMSINTERNALS

AgoodknowledgeoftheOracleRDBMSinternalsisaprerequisitetobeabletouseDULsuccessfully.ForinstancetheDataServerInternals(DSI)coursesgiveagoodfoundation.Thereisevenamodulededicated
toDUL

 

SETTINGUPandUSING DUL

CONFIGURATIONFILES

TherearetwoconfigurationfilesforDUL."init.dul"containsallconfigurationparameters.(sizeofcaches,detailsofheaderlayout,oracleblocksize,outputfileformat)Inthecontrolfile,"control.dul",thedatabasedatafilenamesandtheasmdiskscan
bespecified.

DATA DICTIONARY AVAILABLE

TheOracledatadictionaryisavailableifthedatafileswhichmadeuptheSYSTEMTableSpaceareavailableanduseable.ThenumberwhichOracleassignedtothesefilesandthenameyouhavegiventhem,whichdoesnothavetobetheoriginalnamewhichOracle
knew,mustbeincludedinthe"control.dul"file.YoualsoneedtoeventuallyincludethefilenumbersandnamesofanyfilesfromotherTableSpacesforwhichyouwishtoeventuallyunloadTABLES andtheirdata.Thelackofinclusionofthesefileswillnotaffect
thedatadictionaryunloadstepbutitwillaffectlaterTABLEunloading.

4000
USINGDULWHENUSER$,OBJ$,TAB$andCOL$CAN BE UNLOADED
Stepstofollow:

configureDULforthetargetdatabase.Thismeanscreatingacorrect
init.dulandcontrol.dul.TheSYSTEM TableSpace'sdatafilenumbersandnamesmustbeincludedwithinthecontrol.dulfilealongwithanydatafilesforTableSpacesfromwhichyouwishtounloadTABLEsandtheirdata.ForOracle8andhigherthetablespace
numberandtherelativefilenumbermustbespecifiedforeachdatafile.
Usethe"BOOTSTRAP;"commandtoprepareforunloading.Thebootstrapprocesswillfindacompatibilitysegment,findthebootstrap$tableunloadTheold"duldictv7.ddl"renolongerneeded.
Unloadthetablesforwhichdatafileshavebeenincludedwithinthe"control.dul"file.Useoneofthefollowingcommands:
"UNLOADTABLE[owner>.]table;(donotforgetthesemicolon)
Thiswillunloadtheonetabledefinitionandthetable'sdata.

"UNLOADUSERusername;
Thisunloadsalltablesanddataforthespecifieduser.

"UNLOADDATABASE;
Thisunloadsallofthedatabasetablesavailable.(excepttheuserSYS).

NODATA DICTIONARY AVAILABLE

IfdatafilesarenotavailablefortheSYSTEM TableSpacetheunloadcanstillcontinuebutUSER,TABLEandCOLUMnameswillnotbeknown.Identifyingthetablescanbeanoverwhelmingtask.Butitcanbe(andhasbeen)done.Youneedindepthknowledgeabout
yourapplicationandtheapplicationtables.ColumntypescanbeguessedbyDUL,buttableandcolumnnamesarelost.AnyoldSYSTEMtablespacefromthesamedatabasebutweeksoldcanbeofgreathelp!.MostoftheinformationthatDULusesdoesnotchange.(only
thedataobj#isduringtruncateorindexrebuild)

USINGDULWITHOUTSYSTEMTABLESPACE
Stepstofollow:

configureDULforthetargetdatabase.Thismeanscreatingacorrectinit.dulandcontrol.dul.(SeePort
specificparameters).Inthiscasecontrol.dulfilewillneedthenumbersandnamesofdatafilesfromwhichTABLEsanddatawillbeunloadedbutitdoesnotrequiretheSYSTEMTableSpace'sinformation.
SCANDATABASE;:scanthedatabase,buildextentandsegmentmap
SCANTABLES;orSCANEXTENTS;:gatherrowstatistics
Identifythelosttablesfromtheoutputofstep3.
UNLOADtheidentifiedtables.
AUTOMATEDSEARCH
Toeasethehuntforthelosttables:thescannedstatisticalinformationinseen_tab.datandseen_col.datcanbeloadedintoafreshdatabase.Ifyourecreatethetables(Hopefullythecreatetablescriptsarestillavailable)thenstructureinformationof
a"lost"tablecanbematchedtothe"seen"tablesscannedinformationwithtwoSQL*Plusscripts.(fill.sqlandgetlost.sql).

HINTSANDPITFALLS
NamesarenotreallyrelevantforDUL,onlyforthepersonwhomustloadthedata.Buttheunloadeddatadoesnothaveanyvalue,ifyoudonotknowfromwhichtableitcame.
Theguessedcolumntypescanbewrong.EventhoughthealgorithmisconservativeanddecidesUNKNOWNifnotsure.
TrailingNULLcolumnsarenotstoredinthedatabase.SoifthelastcolumnsonlycontainNULL'sthanthescannerwillNOTfindthem.(DuringunloadtrailingNULLcolumnsarehandledcorrectly).
Whenatableisdropped,thedescriptionisremovedfromthedatadictionaryonly.Thedatablocksarenotoverwrittenunlesstheyarereusedforanewsegment.Sothescannersoftwarecanseeatablethathasbeendropped.
Tableswithoutrowswillgounnoticed.
Newerobjectshaveahigherobjectidthanolderobjects.Ifantableisrecreated,orifthereisatestandaproductionversionofthesametabletheobjectidcanbeusedtodecide.

DDL(DULDescriptionLanguage)UNLOADSTATEMENTOVERVIEW

DULusesanSQLlikecommandinterface.ThereareDDLstatementstounloadextents,tables,usersortheentiredatabase.Datadictionaryinformationrequiredcanbespecifiedintheddlstatementsortakenfromthepreviouslyunloadeddatadictionary.The
followingthreestatementswillunloadtheDEPTtable.Themostcommonformisifthedatadictionaryandtheextentmapareavailable:

 

        UNLOADTABLEscott.dept;

Allrelevantinformationcanbespecifiedinthestatementaswell:

 

       REMColumnswithtypeinthecorrectorder

       REMThesegmentheaderloactioninthestorageclause

       UNLOADTABLEdept(deptnoNUMBER,dnameCHAR,locCHAR)

              STORAGE(EXTENTS(FILE1BLOCK1205));

 

Oracleversion6:

 

       REMversion6datablockshavesegmentheaderlocationineachblock

       ALTERSESSIONSETUSE_SCANNED_EXTENT_MAP=TRUE;

       UNLOADTABLEdept(deptnoNUMBER,dnameCHAR,locCHAR)

              STORAGE(EXTENTS(FILE1BLOCK1205));

Oracle7:

 

       REMOracle7datablockshaveobjectidineachblock

 

       ALTERSESSIONSETUSE_SCANNED_EXTENT_MAP=TRUE;

       UNLOADTABLEdept(deptnoNUMBER,dnameCHAR,locCHAR)

              STORAGE(OBJNO1501);

DUL'SOUTPUTFORMAT.

Onlycompletegoodrowsarewrittentotheoutputfile.Forthiseachrowisbuffered.Thesizeofthebuffercanchangedwiththeinit.dulparameterBUFFER.ThereisnospeedgainedwithahighBUFFERparameter,itshouldjustbebigenoughtoholdacomplete
row.Incompleteorbadrowsarenotwrittenout.TheFILE_SIZE_IN_MBinit.dulparametercanbeusedtosplittheoutput(ataproperboundary)intomultiplefiles,eachfilecanbeloadedindividually.

Therearethreedifferentmodesofoutputformat.

Exportmode
SQL*Loadermode:streamdatafiles
SQL*Loadermode:Fixedphysicalrecorddatafiles

EXPORT MODE

ThegeneratedfileiscompletelydifferentfromatablemodeexportgeneratedbyEXP!ThefileistheminimalformatthatIMPcanload.ForeachtableaseparateIMPloadablefilewillbegenerated.Itisasingletabledumpfile.Itcontainsaheaderaninsert
tablestatementandthetabledata.Tablegrants,storageclauses,ortriggerswillnotbeincluded.Anminimalcreatetablestatementisincluded(nostorageclausejustcolumnnamesandtypeswithoutprecision).Thecharactersetindicationinthefileinthegenerated
headerisV6style.ItissettomeanASCIIbasedcharacterset.

Toenableexportmode,settheinit.dulparameterEXPORT_MODEtoTRUE.

AsthegeneratedpseudodumpfiledoesnotcontaincharactersetinformationsetNLS_LANGtomatchthatoftheoriginaldatabase.Inexportmodenocharactersetconversionisdone.

SQL*LOADER MODES

Thedataintheiseithernotconvertedatall,oreverthingisconvertedtoUTF8ifLDR_OUTPUT_IN_UTF8isset.Thissettingisrequiredinmixedcharactersetenvironmentsasthecontentsofadatafilemusthaveasinglecharacterset.

WhenloadingthedatayouprobablyneedtosetNLS_LANGtomatchthatoftheoriginaldatabasetopreventunwantedcharactersetconversion.

ForbothSQL*Loaderoutputformatsthecolumnswillbespaceseparatedandenclosedindoublequotes.Anydoublequoteinthedatawillbedoubled.SQL*Loaderrecognizesthisandwillloadonlyone.Thecharacterusedtoenclosethecolumnscanbechangedfrom
doublequotetoanycharacteryoulikewiththeinit.dulparameterLDR_ENCLOSE_CHAR.

Therearetwostylesofphysicalrecordorganization:

StreamMode
Nothingspecialisdoneinstreammode,anewlineisprintedaftereachrecord.Thisisacompactformatandcanbeusedifthedatadoesnotcontainnewlinecharacters.ToenablestreammodesetLDR_PHYS_REC_SIZE=0ininit.dul.

FixedPhysicalRecords
Thismodeisessentialifthedatacancontainnewlines.Onelogicalrecord,onecomleterow,canbecomposedofmultiplephysicalrecords.Thedefaultisrecordlengthis81,thisfitsnicelyonthescreenofaVT220.Thephysicalrecordsizecanbespecified
withLDR_PHYS_REC_SIZEininit.dul.

OUTPUT FILE NAMES

Thefilenamesgeneratedare:ownername_tablename.ext.Theextensionis".dmp"forIMPloadablefiles.".dat"and".ctl"areusedfortheSQL*Loaderdatafileandthecontrolfile.Topreventvariablesubstitutionandotherunwantedsideeffects,
strangecharactersarestripped.(Onlyalphanumericand'_'areallowed).

IftheFILEparameterissetthegeneratednameswillbeFILEnnn.ext.Thispossibilityisaworkaroundifthefilesystemdoesnotsupportlongenoughfilenames.(Oldwindowswith6.3filenameformat)

SOMEDULINTERNALS

REQUIREDINFORMATION
Tounloadtabledatafromadatabaseblockthefollowinginformationmustbeknown:

Column/ClusterInformation:Thenumberandtypeofthecolumns.Forcharorvarcharcolumnsthemaximumlengthaswell.Thenumberofclustercolumnsandthetablenumberinthecluster.Thisinformationcanbesuppliedintheunloadstatementoritcan
betakenfromthepreviouslyunloadedUSER$,OBJ$,TAB$andCOL$.
Segment/Extentinformation:Whenunloadingatabletheextenttableinthedatasegmentheaderblockisusedtolocatealldatablocks.Thelocationofthissegmentheaderblock(filenumberandblocknumber)istakenfromthedatadictionaryorcanbe
specifiedintheunloadstatement.Ifthesegmentheaderisnotcorrect/availablethenanothermethodmustbeused.DULcanbuilditsownextentmapbyscanningthewholedatabase.(inaseparaterunofDULwiththescandatabasestatement.)
BINARYHEADERS
C-Structsinblockheadersarenotcopieddirectly,theyareretrievedwithspecializedfunctions.AlloffsetsofstructuremembersareprogrammedintoDUL.Thisapproachmakesitpossibletocross-unload.(UnloadanMVScreateddatafileonanHP)Apartfrom
byteorderonlyfourlayouttypeshavebeenfoundsofar.

VaxVMSandNetware:Noalignmentpaddingbetweenstructuremembers.
KoreanTicomUnixmachines:16bitalignmentofstructuremembers.
MS/DOS16bitalignmentand16bitwordsize.
Restoftheworld(IncludingAlphaVMS)structurememberalignmentonmembersize.
MACHINEDEPENDENCIES
Machinedependencies(ofthedatabase)areconfigurablewithparameters:

Orderofbytesinaword(big/littleendian).
NumberofbitsforthelowpartoftheFILE#inaDBA(BlockAddress).
AlignmentofmembersinaC-struct.
Numberofblocksorbytesbeforetheoraclefileheaderblock.
Sizeofawordusedinthesegmentheaderstructure.
UNLOADINGTHEDATADICTIONARY
DULcanusethedatadictionaryofthedatabasetobeunloadedifthefilesforitexistandareuncorrupted.Forthedatadictionarytobeused,internaltablesmustbeunloadedfirsttoexternalfiles:(USER$,OBJ$,TAB$andCOL$).Thebootstrapcommandwill
findandunloadtherequiredtables.

DDL(DULDESCRIPTIONLANGUAGE)SPECIFICATION

 

[ALTERSESSION]SETinit.dulparameter= value;

    Mostparameterscanbechangedonthefly.

 

BOOTSTRAP[LOCATE|GENERATE|COMPLETE

          |UNLOAD  Bootstrap$segmentheaderblockaddress];

    Bootstrapsthedatadictionary.DefaultisCOMPLETE.

    LOCATEfindsandunloadsthebootstrap$table.

    GENERATEbuildsaddlfilebasedoninforationinthecache.

    COMPLETEisinfactLOCATE,followedbyGENERATE(twotimes)

 

COMMIT;

    Writesthechangedblocktothedatafile.

 

CREATEBLOCKINDEX index_name ON device;

Ablockindexcontainsaddressofvalidoracleblocksfoundinacorruptfilesystem.Usefultomergemultiplediskimagesortounloadfromcorruptedfilesystems.Thisisonlyusefulinextremefilesystemcorruptionscenarios.

 

DESCRIBE owner_name .table_name;

 

DUMP[TABLESPACE tablespace_no]

    [FILE file_no ]

    [BLOCK block_no ]

    [LEVEL level_no ];

    Notacompleteblockdump,mainlyusedfordebugging.

    Theblockaddressisremembered.

 

EXTRACT asmfilename to outputfilename ;

    CopiesanyASMfilefromadiskgrouptothefilesystem.

    (therewasaproblemwithonlineredologsthisneedsmoretesting)

 

MERGEblock_indexINTO[ segment ];

Themergecommandusestheinformationintheindexfiletolocatepossibledatablocksitlooksforacombinationoffilenumbersandobjectid,eachcandidateblockiscomparedtothecurrentblockinthedatafile.Ifthecurrentblockisbad,orhasanolder
scnthecandidatewillwillbewrittenintothedatafile.Thisisonlyusefulinextremefilesystemcorruptionscenarios.

 

REMany_text_you_like_till_End_Of_Line:comment

REM NOTallowedinsideddlstatements.(Toavoidatwolayerlexicalscan).

 

ROLLBACK;#CancelstheUPDATEstatements.

 

SHOW    DBA dba;               #dba->file_noblock_nocalculator

         |DBA rfile_noblock_no; #file_noblock_no->dbacalculator

         |SIZES;                  #showsomesizeofimportantstructs

         |PARAMETER;               #showsthevaluesofallparameters

         |LOBINFO;                 #lobindexesfoundwithSCANDATABASE

      |DATAFILES;               #summaryofconfigureddatafiles

      |ASMDISKS;               #summaryofconfiguredasmdisks

      |ASMFILES;               #summaryofconfigureddatafilesonasm

      |ASMFILE cid     #extentinformationforasmfile

 

UNEXP[ owner .] tablename
       ( columnlist )[DIRECT]

      DUMPFILE dumpfilename

      FROM beginoffset [UNTIL endoffset ]

      [MINIMUM minimalnumberofcolumns COLUMNS];

 

      Tounloaddatafromacorruptedexpdumpfile.Nospecialsetup

      orconfigurationisrequired,justthecompatibleparameter.

      Thestartoffsetshouldbewherearowactuallybegins.

 

UNPUMP

      Tounloaddatafromacorruptedexpdp(datapump)dumpfile.

      Thisisstillworkinprogress,thebasiccommandswork

      butrathercomplextouse.Contactmeifthisisneeded.

 

UNLOADDATABASE;

 

UNLOADUSERuser_
13dd7
name;

 

UNLOAD
 [ schema_name.] table_name
              [PARTITION( partition_name)]

             [SUBPARTITION( sub_partition_name)]

             [( column_definitions)]

             [ cluster_clause ]

             [ storage_clause ];

 

UNLOADEXTENT table_name

              [( column_definitions )]

             [TABLESPACE tablespace_no ]

              FILE extent_start_file_number

             BLOCKextent_start_block_number

              BLOCKS extent_size_inoracle_blocks;

 

UNLOADLOBSEGMENTFOR[ schema_name.] table_name  [( columnname )];

 

UNLOADLOBSEGMENTSTORAGE(SEGOBJNOdataobj#);

 

UPDATE[block_address]SETUB1|UB2|UB4@offset_in_block=new_value;

UPDATE[block_address]SET blockelementname =new_value;

       Nowandthenwecanrepairsomething.

       Patchesthecurrentblockanddumpsit.

       YoucanissuemultipleUPDATEcommands.

       Blockisnotwrittenyet,useCOMMITtowrite.

 

storage_clause::=

       STORAGE(storage_specification [more_storage_specs])

 

storage_specification::=

       OBJNOobject_id_number

|      TABNOcluster_table_number

|      SEGOBJNOcluster/data_object_number      /*v7/v8styledatablockid*/

|      FILE data_segment_header_file_number    /*v6styledatablockid*/

       BLOCKdata_segment_header_block_number)  

|      any_normal_storage_specification_but_silently_ignored

 

SCANDATABASE;

Scansallblocksofalldatafiles.Twoorthreefilesaregenerated:

SEG.datinformationoffoundsegmentheaders(index/cluster/table):(objectid,filenumber,andblocknumber).
EXT.datinformationofcontiguoustable/clusterdatablocks.(objectid(V7),fileandblocknumberofsegmentheader(V6),filenumberandblocknumberoffirstblock,numberofblocks,numberoftables)
SCANNEDLOBPAGE.datinformationforeachlobdatablock,thisfile(optional,onlyifinit.dul:SCAN_DATABASE_SCANS_LOB_SEGMENTS=TRUE)canpossiblybehuge.Alsotherequiredmemorysizecanbeproblematic.Thepurposeistwofold:1:topossiblyworkaround
corruptlobindexesduringunloadtable.2:unloadlobsegments(fordeletedlobsorlobsegmentswithoutlobindexorparenttable)MeaningofthefieldsinSCANNEDLOBPAGE.dat:(segobj#,lobid,fat_page_no,version(wrap,base),ts#,file#,block#)
 

SCANDUMPFILE dumpfilename

       [FROM beginoffset ]

       [UNTIL endoffset ];

 

       Scansan exportdumpfiletoproducetoprovidethe

       create/insertstatementsandtheoffsetsinthedumpfile.

 

SCANLOBSEGMENT   storageclause;

SCANLOBSEGMENTFOR tablename [. columnname];

       ScansthelobsegmenttoproduceLOBPAGE.datinformation,

       butthenforthissegmentonly.Probablyquickerand

       smaller.Forpartitionedobjectsusescandatabase.

 

SCANTABLES;

       UsesSEG.datandEXT.datasinput.

       Scansalltablesinalldatasegments(aheaderblockandatleastone

       matchingextentwithatleast1table).

 

SCANEXTENTS;

       UsesSEG.datandEXT.datasinput.

       Allextentsforwhichnocorrespondingsegmentheaderhasbeenfound.

       (Onlyusefulifatablespaceisnotcomplete,orasegmentheader

       iscorrupt).

 

EXITQUITandEOFallcauseDULtoterminate.

 

DDL(DULDESCRIPTIONLANGUAGE)DESCRIPTION

RulesforUNLOADEXTENTandUNLOADTABLE:

ExtentMap

UNLOADTABLErequiresanextentmap.In99.99%ofthecasestheextentmapinthesegmentheaderisavailable.Intherare0.01%thatthesegmentheaderislostanextentmapcanbebuildwiththescandatabasecommand.TheselfbuildextentmapwillONLYbe
usedduringanunloadiftheparameterUSE_SCANNED_EXTENT_MAPissettoTRUE.

AlldatablockshavesomeIDofthesegmenttheybelongto.ButthereisafundamentaldifferencebetweenV6andV7.DatablockscreatedbyOracleversion6havetheaddressofthesegmentheaderblock.DatablockscreatedbyOracle7havethesegmentobject
idintheheader.

ColumnSpecification

Thecolumndefinitionsmustbespecifiedintheorderthecolumnsarestoredinthesegment,thatisorderedbycol$.segcol#.Thisisnotnecessarilythesameorderasthecolumnswherespecifiedinthecreatetablestatement.Clustercolumnsaremovedtothe
front,longstotheend.Columnsaddedtothetablewithaltertablecommand,arealwaysstoredlast.

Unloadingasingleextent

UNLOADEXTENTcanbeusedtounload1ormoreadjacentblocks.TheextenttobeunloadedmustbespecifiedwiththeSTORAGEclause:Tospecifyasingleextentuse:STORAGE(EXTENTS(FILEfnoBLOCK
bnoBLOCKS#blocks))(FILEandBLOCKspecifythefirstblock,BLOCKSthesizeoftheextent)

DULspecificcolumntypes

TherearetwoextraDULspecificdatatypes:

IGNORE:thecolumnwillbeskippedasifitwasnotthereatall.
UNKNOWN:aheuristicguesswillbemadeforeachcolumn.
InSQL*LoadermodethereareevenmoreDULspecificdatatypes:

HEXRAW:columnisHEXdumped.
LOBINFO:showsomeinformationfromLOBlocators.
BINARYNUMBER:MachinewordasusedinaLOBindex.

IdentifyingUSER$,OBJ$,TAB$andCOL$

DULusesthesamebootstrapprocedureastherdbms.Thatisitusestherootdbafromthesystemdatafileheadertolocatethebootstrap$table.Dependingontheversionthisrootdbaiseitherthelocationofthecompatibilitysegmentcontainingthebootstrap$
addressorforthenewerversionstheaddressofthebootstrap$tableitself.Thebootstrap$tableisunloadedanditscontentsisparsedtofindthefirstfourtables(USER$,OBJ$,TAB$andCOL$).Theothertablesareunloadedbasedoninformationinthesefirst
four.

DESCRIPTIONOFSCANCOMMANDS

SCANTABLESandSCANEXTENTSscanforthesameinformationandproducesimilaroutput.ALLcolumnsofALLrowsareinspected.Foreachcolumnthefollowingstatisticsaregathered:

Howoftenthecolumnisseeninadatablock.
Themaximuminternalcolumnlength.
HowoftenthecolumnISNULL.
Howoftenthecolumnconsistsofatleast75%printableascii.
Howoftenthecolumnconsistsof100%printableascii.
Howoftenthecolumnisavalidoraclenumber.
Howoftenthecolumnisanicenumber.(notmanyleadingortrailingzero's)
Howoftenthecolumnisavaliddate.
Howoftenthecolumnisapossiblevalidrowid.
Thesestatisticsarecombinedandacolumntypeissuggested.Usingthissuggestionfiverowsareunloadedtoshowtheresult.Thesestatisticsaredumpedtotwofiles(seen_tab.datandseen_col.dat).ThereareSQL*LoaderandSQL*Plusscriptsavailabletoautomate
apartoftheidentificationprocess.(Currentlyknownasthegetlostoption).

DESCRIBE

Thereisadescribecommand.Itwillshowthedictionaryinformationforthetable,availableinDUL'sdictionarycache.

DULSTARTUPSEQUENCE

DuringstartupDULgoesthroughthefollowingsteps:

theparameterfile"init.dul"isprocessed.
theDULcontrolfile(default"control.dul")isscanned.
TrytoloaddumpsoftheUSER$,OBJ$,TAB$andCOL$ifavailableintoDUL'sdatadictionarycache.
Trytoloadseg.datandcol.dat.
AcceptDDL-statementsorruntheDDLscriptspecifiedasfirstarg.

DULparameterstobespecifiedininit.dul:

ALLOW_TRAILER_MISMATCH

BOOLEAN

Stronglydiscouragedtouse,willseldomproducemorerows.Useonlyifyoufullyunderstandwhatitmeansandwhyyouwantit.skipsthecheckforcorrectblocktrailer.Theblocksfailingthistestaresplitofcorrupt.Butitsavesyouthetroubletopatchsome
blocks.

ALLOW_DBA_MISMATCH

BOOLEAN

Stronglydiscouragedtouse,willseldomproducemorerows.Useonlyifyoufullyunderstandwhatitmeansandwhyyouwantit.Skipsthecheckforcorrectblockaddress.Theblocksfailingthistestareprobablycorrupt.Butitsavesyouthetroubletopatchsome
blocks.

ALLOW_OTHER_OBJNO

BOOLEAN

Ifyourdictionaryisolderthanyourdatafilesthenthedataobjectid'scandifferfortruncatedtables.Withthisparametersettotrueitwillissueawarningbutusethevaluefromsegmentheader.Allotherblocksarefullychecked.Thisisforspecial
casesonly.

ASCII2EBCDIC

BOOLEAN

Must(var)charfieldsbetranslatedfromEBCDICtoASCII.(ForunloadingMVSdatabaseonaASCIIhost)

BUFFER

NUMBER(bytes)

rowoutputbuffersizeusedinbothexportandSQL*Loadermode.Ineachrowisfirststoredinthisbuffer.Onlycompleterowswithouterrorsarewrittentotheoutputfile.

COMPATIBLE

NUMBER

Databaseversion,validvaluesare6,7,8or9.Thisparametermustbespecified

CONTROL_FILE

TEXT

NameoftheDULcontrolfile(default:"control.dul").

DB_BLOCK_SIZE

NUMBER

Oracleblocksizeinbytes(Maximum32K)

DC_COLUMNS

NUMBER

DC_OBJECTS

NUMBER

DC_TABLES

NUMBER

DC_USERS

NUMBER

Sizesofduldictionarycaches.Ifoneoftheseistoolowthecachewillbeautomaticallyresized.

EXPORT_MODE

BOOLEAN

EXPortlikeoutputmodeorSQL*Loaderformat

FILE

TEXT

Basefor(dumpordata)filenamegeneration.Usethison8.3DOSlikefilesystems

FILE_SIZE_IN_MB

NUMBER(Megabytes)

Maximumdumpfilesize.Dumpfilesaresplitintomultipleparts.Eachfilehasacompleteheaderandcanbeloadedindividually.

LDR_ENCLOSE_CHAR

TEXT

ThecharactertoenclosefieldsinSQL*Loadermode.

LDR_PHYS_REC_SIZE

NUMBER

Physicalrecordsizeforthegeneratedloaderdatafile.

LDR_PHYS_REC_SIZE=0Nofixedrecords,eachrecordisterminatedwithanewline.

LDR_PHYS_REC_SIZE>2:Fixedrecordsize.

MAX_OPEN_FILES

Maximum#ofdatabasefilesthatareconcurrentlykeptopenattheOSlevel.

OSD_BIG_ENDIAN_FLAG

Byteorderinmachineword.BigEndianisalsoknownasMSBfirst.DULsetsthedefaultaccordingtothemachineitisrunningon.ForanexplanationwhythisiscalledBigEndian,youshouldreadGulliversTravels.

OSD_DBA_FILE_BITS

FileNumberSizeinDBAinbits.Ortobemoreprecisethesizeoftheloworderpartofthefilenumber.

OSD_FILE_LEADER_SIZE

bytes/blocksaddedbeforetherealoraclefileheaderblock

OSD_C_STRUCT_ALIGNMENT

CStructurememberalignment(0,16or32).Thedefaultof32iscorrectformostports.

OSD_WORD_SIZE

Sizeofamachinewordalways32,exceptforMS/DOS(16)

PARSE_HEX_ESCAPES

BooleandefaultFALSE

Use\\xhhhexescapesequencesinstringswhileparsing.Ifsettotruethenstrangecharacterscanbespecifiedusingescapesequences.Thisfeatureisalsoforspecifyingmulti-bytecharacters.

USE_SCANNED_EXTENT_MAP

BOOLEAN

Usethescannedextentmapinext.datwhenunloadingatable.Thenormalalgorithmeusestheextentmapinthesegmentheader.Thisparameterisonlyusefulifsomesegmentheadersaremissingorincorrect.

WARN_RECREATE_FILES

BOOLEAN(TRUE)

SettoFALSEtosuppressthewarningmessageifanexistingfileisoverwritten.

WRITABLE_DATAFILES

BOOLEAN(FALSE)

NormaluseofDULwillonlyreadthedatabasefiles.HowevertheUPDATEandtheSCANRAWDEVICEwillwriteaswell.Theparameteristheretopreventaccidentaldamage.

SAMPLEinit.dul:

 

#sampleinit.dulconfigurationparameters

#thesemustbebigenoughforthedatabaseinquestion

#thecachemustholdallentriesfromthedollartables.

dc_columns=200000

dc_tables=10000

dc_objects=10000

dc_users=40

 

#OSspecificparameters

osd_big_endian_flag=false

osd_dba_file_bits=10

osd_c_struct_alignment=32

osd_file_leader_size=1

 

#databaseparameters

db_block_size=8k

 

#loaderformatdefinitions

LDR_ENCLOSE_CHAR="

LDR_PHYS_REC_SIZE=81

Configuringtheportdependentparameters

Startingfromrdbmsversion10Gosdparametersareeasytoconfigure.Typicallyallparameterscanbeusedattheirdefaults.Theonlyonethatmightneedattentionisosd_big_endian_flag,whendoingacrossplatformunload,wheretheoriginaldatabaseplatform
isdifferentfromthecurrentmachine.Ifosd_big_endian_flagissetincorrectly,itisdetectedatstartup,whendoingfileheaderinspection.

CollectionofknownParameters

Forpre10Gdatabasesthereisalistofknownparametersintheosdwikipage
listofosd(OperatingSystemDependend)parametersforalmosteveryplatform.Ifyourplatformisnotinthelistyoucanusethesuggestionsbelowtodeterminetheparameters.(AndthenpleaseinformmesoIcanaddthemtothelist.)

osd_big_endian_flag
bigendianorlittleendian(byteorderinmachinewords):HP,SUNandmainframesaregenerallybigendian:OSD_BIG_ENDIAN_FLAG=TRUE.DECandIntelplatformsarelittleendian:OSD_BIG_ENDIAN_FLAG=FALSE.ThedefaultiscorrectfortheplatformwhereDUL
isrunningon.

Thereisnostandardtrickforthis,thefollowingmightworkonaunixsystem:

 echodul|od-x

 Iftheoutputislike:

    000000064756c0a

    0000004

 Youareonabigendianmachine(OSD_BIG_ENDIAN_FLAG=TRUE).

 

 Ifyousee:

    000000075640a6c

    0000004

 Thisisalittleendianmachine(OSD_BIG_ENDIAN_FLAG=FALSE).

osd_dba_file_bits
Thenumberofbitsinadbausedfortheloworderpartoffilenumber.Performthefollowingquery:

 

 SQL>selectdump(chartorowid('0.0.1'))fromdual;

 

  Typ=69Len=6:8,0,0,0,0,0   ->      osd_dba_file_bits= 5(SCO)

 Typ=69Len=6:4,0,0,0,0,0   ->      osd_dba_file_bits= 6(Sequent,HP)

 Typ=69Len=6:1,0,0,0,0,0   ->      osd_dba_file_bits= 8(NCR,AIX)

 Typ=69Len=6:0,16,0,0,0,0  ->      osd_dba_file_bits=12(MVS)

 Typ=69Len=10:0,0,0,0,0,64,0,0,0,0     osd_dba_file_bits=10(Oracle8)      

OSD_C_STRUCT_ALIGNMENT
Structurelayoutindatafileheaders.0:NopaddingbetweenmembersinaC-struct(VAX/VMSonly)16:SomekoreanticommachinesandMS/DOS32:Structuremembersaremembersizealigned.(AllothersincludingALPHA/VMS)Checkthefollowingquery:

 

SELECT*FROMv$type_size

WHEREtypeIN('KCBH','KTNO','KCBH','KTBBH','KTBIT','KDBH'

             ,'KTECT','KTETB','KTSHC');

Ingeneralosd_c_struct_alignment=32andthefollowingoutputisexpected:

 

K       KTNO    TABLENUMBERINCLUSTER                  1

KCB     KCBH    BLOCKCOMMONHEADER                     20

KTB     KTBIT   TRANSACTIONVARIABLEHEADER             24

KTB     KTBBH   TRANSACTIONFIXEDHEADER                48

KDB     KDBH    DATAHEADER                             14

KTE     KTECT   EXTENTCONTROL                          44

KTE     KTETB   EXTENTTABLE                             8

KTS     KTSHC   SEGMENTHEADER                           8

 

8rowsselected.

ForVAX/VMSandNetwareONLYosd_c_struct_alignment=0andthisoutputisexpected:

 

COMPONENTYPE    DESCRIPTION                     SIZE

----------------------------------------------------------

K       KTNO    TABLENUMBERINCLUSTER                  1

KCB     KCBH    BLOCKCOMMONHEADER                     20

KTB     KTBIT   TRANSACTIONVARIABLEHEADER             23

KTB     KTBBH   TRANSACTIONFIXEDHEADER                42

KDB     KDBH    DATAHEADER                             14

KTE     KTECT   EXTENTCONTROL                          39

KTE     KTETB   EXTENTTABLE                             8

KTS     KTSHC   SEGMENTHEADER                           7

 

8rowsselected.

IfthereisadifferentlistthiswillrequiresomemajorhackingandsniffingandpossiblyamajorchangetoDUL.(EmailBernard.van.Duijnen@oracle.com)

osd_file_leader_size
Numberofblocks/bytesbeforetheoraclefileheader.Unixdatafileshaveanextraleadingblock(filesize,blocksizemagicnumber)Alargenumber(>100)isseenasabyteoffset,asmallnumberisseenasanumberoforacleblocks.

 

Unix   :      osd_file_leader_size=1

Vms    :      osd_file_leader_size=0

Desktop:      osd_file_leader_size=1(or512foroldpersonaloracle)

Others :      Unknown(UseAndreBakker'sfamousPATCHutilitytofindout)

               AnOracle7fileheaderblockstartswiththepattern0X0B010000.

Youcanaddanadditionalbyteoffsetincontrol.dulintheoptionalthirdfield(forinstanceforAIXorDECUNIXdatafilesonrawdevice)

Controlfilesyntaxspecification

Acontrolfile(defaultname"control.dul")isusedtospecifyasmdisks,blockindexesandthedatafilenames.Theformatofthecontrolhasbeenextended

CurrentlytherearethreetypesofspecificationsintheDULcontrolfile.Eachentryonaseparateline.Theasmdisksmustprecedetheasmfiles.

 

 control_file_line::=asm_disk_spec|file_piece_spec|block_index_spec

IfCOMPATIBLEis10orhigheryoucanalsospecifyasmdisks.Itsgenerallysufficenttospecifythedevicename.Allpropertiesareautomaticallyretrievedbyheaderinspection.Thefullsyntaxisonlyneededwhenheaderinspectionisimpossible,thatisfor
diskswithcorruptheaders.Thesyntaxis:

 

DISK devicename[ diskgroupoptions ]

 

diskgroupoption ::=GROUP diskgroupname

                           |DISK_NO disknumberingroup

                           |F1B1 File1Block1location

Ablockindexisawaytoaccessoracleblocksoncorruptfilesystems.Ingeneralacorruptfilesystemisnotwipedout,itsnotempty.Duetothespecificlayoutoforacleblocksitispossibletodatablocksanstoretheirlocationintheblockindex.See
alsothecreateblockindexcommand.Ablock_index_nameisanormalidentifier,itisusedtoconstructanuniquefilename.

 

BLOCKINDEX block_index_name

 

 Eachentrycancontainapartofadatafile.

Thesmallestunitisasingledatablock.

ThiswayitispossibletosplitdatafilesthataretoobigforDUL

inpartswhereeachpartissmallerthan2GB.

 

 

 Ingeneralitissufficienttospecifythefilename.

Evenforasingleblock.

Ifcompatibleis10orhigherthefilenumbersandthetablespace

numberswillbereadfromthefileheader.

 

 

Ifthespecifieddetailsaredifferentfromthefileheader

DULwillgiveawarningbutuseyourspecification.

Thisis tobeabletounloadfileswithacorruptedheaderblock.

Fordebuggingitispossibletodumpthefileheader. 

 

 

 Theoptionalextraleaderoffsetisanextrabyteoffset,

thatwillbeaddedtoalllseek()operationsforthatdatafile.

Thismakesitpossibletoskipovertheextra4kblockforsome

AIXrawdevices,ortheextra64KonTru64onrawdevices

 

 

 

 file_piece_spec::=

         [[tablespace_no]relative_file_number]data_file_name

        [optionalextraleaderoffset]

        [startblockblock_no]

        [endblockblock_no]

 

 

 

Examples

 

 

 

  #AIXversion7examplewithonefileonrawdevice

  1/usr/oracle/dbs/system.dbf

  8/dev/rdsk/data.dbf4096

 

 

 

  #Oracle8examplewithadatafilesplitinmultipleparts,eachpartsmallerthan2GB

  0 1/fs1/oradata/PMS/system.dbf

  1 2/tmp/huge_file_part1startblock1endblock1000000

  1 2/tmp/huge_file_part2startblock1000001endblock2000000

  1 2/mnt3/huge_file_part3startblock2000001endblock2550000


 

 

#ASMdisksfortwodiskgroups

disk/media/maxtor/asm/dgn1

disk/media/maxtor/asm/dgn2

disk/media/maxtor/asm/dgn3

disk/media/maxtor/asm/dgn4

disk/media/maxtor/asm/dgodd

 

#systemdatafileinthefirstasmdiskgroup

+DGN/db102/datafile/system.257.621616979

 

#usersdatafileinadifferentdiskgroup

+DGODD/db102/datafile/users.257.621616683

 

#asocalledbigfiletablespace,use1024forthefile#

81024/home/oracle/v102/dbs/bigfilets

 

#OrletDULfindoutitselffromtheheader

/home/oracle/v102/dbs/bigfilets

 

#onetablespacewithadifferentblocksize

/home/oracle/v102/dbs/ts16k.dbfblock_size16k

 

#orletDULfindoutbyheaderinspection

/home/oracle/v102/dbs/ts16k.dbf

 

 

 

 

Sampleunloadsession:datadictionaryusableforDUL

 

 

 

1. createasuitable"init.dul"

 

 

2. createacontrol.dul

 

 

   sqlplus/nolog

   connect/assysdba

   startupmount

   settrimspoolonpagesize0linesize256feedbackoff

   columnnameformata200

   spoolcontrol.dul

   selectts#,rfile#,namefromv$datafile;

   exit

edittheresult

 

 

 

ForOracle8adifferentquerymustbeused:

  selectts#,rfile#,namefromv$datafile;

 

3.  startDULandbootstrap;

 

 

$dul

 

DataUnLoader10.2.1.16-OracleInternalOnly-onThuJun2811:37:242007

with64-bitiofunctions

 

Copyright(c)19942007BernardvanDuijnenAllrightsreserved.

 

StrictlyOracleInternaluseOnly

DUL>bootstrap;

Probingfile=1,block=377

.unloadingtable               BOOTSTRAP$     57rowsunloaded

DUL:Warning:DictionarycacheDC_BOOTSTRAPisempty

ReadingBOOTSTRAP.dat57entriesloaded

ParsingBootstrap$contents

DUL:Warning:Recreatingfile"dict.ddl"

Generatingdict.ddlforversion10

OBJ$:segobjno18,file1

TAB$:segobjno2,tabno1,file1

COL$:segobjno2,tabno5,file1

USER$:segobjno10,tabno1,file1

Runninggeneratedfile"@dict.ddl"tounloadthedictionarytables

.unloadingtable                     OBJ$  52275rowsunloaded

.unloadingtable                     TAB$   1943rowsunloaded

.unloadingtable                     COL$  59310rowsunloaded

.unloadingtable                    USER$     70rowsunloaded

ReadingUSER.dat70entriesloaded

ReadingOBJ.dat

52275entriesloadedandsorted52275entries

ReadingTAB.dat1943entriesloaded

ReadingCOL.dat59310entriesloadedandsorted59310entries

ReadingBOOTSTRAP.dat57entriesloaded

...

SomemoremessagesforalltheotherTABLES

...

DatabasecharactersetisWE8ISO8859P1

DatabasenationalcharactersetisAL16UTF16

DUL>unloaduserSCOTT;

AbouttounloadSCOTT'stables...

.unloadingtable                      EMP     14rowsunloaded

 

 

 

 

 

Exampleunloadsession:datadictionaryUNUSABLEforDUL

 

 

 

1. createasuitable"init.dul"(Seeconfigguide)

 

2. createacontrol.dulSeeabove

 

3. scanthedatabaseforsegmentheadersandextents:

 

 

$dul

UnLoader:Version2.0.0.0-VeryRestrictedonTueMay1611:10:161995

Copyright(c)1994/95OracleCorporation,TheNetherlands.Allrightsreserved.

DUL>scandatabase;

datafile120480blocksscanned

datafile47680blocksscanned

datafile5512blocksscanned

DUL>quit

 

 

4. RestartDULandscanthefoundtablesforcolumnstatisticsthiscreates

5. ahugeamountofoutput:

 

 

 

echoscantables\;|dul>scan.out&

 

[manylineshere]

 

 

Objectid1601tablenumber0

UNLOADTABLET1601_0(C1NUMBER,C2UNKNOWN,C3UNKNOWN,C4NUMBER,C5DATE

       ,C6NUMBER,C7NUMBER,C8NUMBER)

   STORAGE(TABNO0EXTENTS(FILE1BLOCK10530));

 

Colno SeenMaxIntSzNull%C75%C100Num%NiNu%Dat%Rid%

   1   14       3   0%  0%  0%100%100%  0%  0%

   2   14       6   0%100%100%100% 14%  0% 21%

   3   14       9   0%100%100%100% 14%  0%  0%

   4   14       3   7%  0%  0%100%100%  0%  0%

   5   14       7   0%  0%  0%  0%  0%100%  0%

   6   14       3   0%  0%  0%100%100%  0%  0%

   7   14       2  71%  0%  0%100%100%  0%  0%

   8   14       2   0%  0%  0%100%100%  0%  0%

 

"7369""SMITH""CLERK""7902""17-DEC-1980AD00:00:00""800""""20"

 

"7499""-0.000025253223""SALESMAN""7698""20-FEB-1981AD00:00:00""1600""30+

 

0""30"

 

"7521""WARD""SALESMAN""7698""22-FEB-1981AD00:00:00""1250""500""30"

 

"7566""JONES""MANAGER""7839""02-APR-1981AD00:00:00""2975""""20"

 

"7654""MARTIN""SALESMAN""7698""28-SEP-1981AD00:00:00""1250""1400""30"

 

[manymorelineshere]

 

 

Thislooksfamiliar,usetheaboveinformationandyourknowledgeof

theemptabletocompose:

 

 

UNLOADTABLEemp(empnonumber,enamechar,jobchar,mgrnumber,

       hiredatedate,salnumber,commnumberdeptnonumber)

STORAGE(TABNO0EXTENTS(FILE1BLOCK10530));

 

 

6. usethisstatementtounloademp:

 

 

$dul

UnLoader:Version2.0.0.0-VeryRestrictedonTueMay1611:46:331995

Copyright(c)1994/95OracleCorporation,TheNetherlands.Allrightsreserved.

Loaded350segments

Loaded204extents

Extentmapsorted

DUL>UNLOADTABLEemp(empnonumber,enamechar,jobchar,mgrnumber,

DUL2>hiredatedate,salnumber,commnumberdeptnonumber)

DUL3>STORAGE(TABNO0EXTENTS(FILE1BLOCK10530));

.unloadingtable                      EMP     14rowsunloaded

DUL>quit


 

 

 

Exampleunloadsession:Incorrectinit.dulParameters

 

 

WRONGosd_dba_file_bitssize

 

 

Thiscangenerateoutputsimilartobelow.Normallythisshouldnot

happensinceyoushouldcreateademodatabaseandcheckthisviatheDUL

documented(inhtmlpage)query.

 

 ThemismatchinDBA'sisonlyinthefilenumber(firstnumberinbrackets)part.

Thesecondnumber,theblocknumber,iscorrect.

 

 

DataUnLoader:Release3.2.0.1-InternalUseOnly-onWedSep310:40:331997

Copyright(c)1994/95OracleCorporation,TheNetherlands.Allrightsreserved.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

DUL:Warning:Block[1][2]DBAinblockmismatch[4][2]

DUL:Warning:Badcachelayerheaderfile#=1,block#=2

 

DUL:Warning:Block[1][3]DBAinblockmismatch[4][3]

DUL:Warning:Badcachelayerheaderfile#=1,block#=3

 

...........andetc..........

 

 

WRONGosd_file_leader_size

 

 

 

Thismaycreateoutputsimilartobelow,butmanyotherflavoursarepossible.Inthiscaseweareafixednumberof

blocksoff.Thefilenumberiscorrect.Thedifferenceintheblocknumbersisconstant.:

 

 

DataUnLoader:Release3.2.0.1-InternalUseOnly-onWedSep310:44:231997

Copyright(c)1994/95OracleCorporation,TheNetherlands.Allrightsreserved.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

 

DUL:Warning:Block[1][2]DBAinblockmismatch[1][3]

DUL:Warning:Badcachelayerheaderfile#=1,block#=2

 

DUL:Warning:Block[1][3]DBAinblockmismatch[1][4]

DUL:Warning:Badcachelayerheaderfile#=1,block#=3

 

...........andetc..........

 

 

 

WRONGosd_c_struct_alignment

 

 

Thismaygenerateoutputsimilartothefollowing:

 

 

 

DataUnLoader:Release3.2.0.1-InternalUseOnly-onWedSep310:46:101997

Copyright(c)1994/95OracleCorporation,TheNetherlands.Allrightsreserved.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

.unloadingtableOBJ$

 

DUL:Warning:file#0isoutofrange

DUL:Warning:Cannotreaddatablockfile#=0,block#=262145

OSerror2:Nosuchfileordirectory

 

DUL:Warning:file#0isoutofrange

DUL:Warning:Cannotreaddatablockfile#=0,block#=262146

OSerror2:Nosuchfileordirectory

 

...........andetc..........

 

WRONGdb_block_size

 

 

Thefollowingoutputwasgeneratedwhenthedb_block_sizewassettoo

small.Thecorrectvaluewas4096anditwassetto2048.Normally,the

valueforthisparametershouldbetakenfromtheOracleinstances'sinit.ora

fileandwillnotbecorrectlyset.

 

 

 

DataUnLoader:Release3.2.0.1-InternalUseOnly-onThuSep412:38:251997

Copyright(c)1994/95OracleCorporation,TheNetherlands.Allrightsreserved.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

Sessionaltered.

DUL:Warning:Block[1][2]DBAinblockmismatch[513][1159680]

DUL:Warning:File=1,block2:illegalblockversion2

DUL:Warning:Block[1][2]Illegalblocktype[0]

DUL:Warning:Badcachelayerheaderfile#=1,block#=2

 

DUL:Warning:Block[1][4]DBAinblockmismatch[1][2]

DUL:Warning:File[1]Block[4]INCSEQmismatch[90268!=0]

DUL:Warning:Badcachelayerheaderfile#=1,block#=4

 

DUL:Warning:Block[1][6]DBAinblockmismatch[1][3]

DUL:Warning:File[1]Block[6]INCSEQmismatch[139591710!=86360346]

DUL:Warning:Badcachelayerheaderfile#=1,block#=6

 

...........andetc..........

 

 

QUOTEMISSING

 

 

Ifyougetthefollowingerroritiscausedbythedatadictionarytables

"USER$,OBJ$,TAB$andCOL$"notbeingcorrectlygenerated.To

fixthiserrorsimplydeletealldictv6.ddlordictv7.ddlcreated.dat

and.ctlfilesandrestart.

 

 

 

DataUnLoader:Release3.2.0.1-InternalUseOnly-onWedSep310:49:301997

 

Copyright(c)1994/95OracleCorporation,TheNetherlands.Allrightsreserved.

 

 

DUL:Error:Quotemissing

SalvagingdatafromcorruptEXPdumpfiles-UNEXPTutorial

IfyoudonotknowanythingaboutthestructureofaEXPdumpfilethiscanbedifficult.Hereisaquickexplanation.ApartfromthefileheaderadumpfilehasMARKERSthatidentifythevarioussections.IneachtablesectiontherewillbeSQLstatements.
Themostinterrsestingpartisthecreatetablestatement,followedbytheinsertintotablestatement.Theinsertstatementisdirectlyfollowedbythebindinformation,(numberofcolumns,andforeachcolumnitstypeandbindlengthandasmallbitmore).
Thenitisfollowedbytheactualcolumns.Eachcolumnisprecededbyatwobytelength,followedbytheactualcolumndata.Thereareseveraltricksforlongercolumnspossible.TheendofthecolumndataismarkedbythespeciallengthmarkerOXFFFF.Thereis
nomarkerforthebeginningofarow.Resynchingafteracorruptionistrialanderror.Corruptionaregenerallynotimmediatedetectable.TheformatisslightlydifferentforDIRECTexport,soyouwillhavetousetheDIRECToptionforDIRECTexports.Theoffset
tobespecifiedisthebeginningofarow.Ingeneralthefirstonedirectlybehindthebindarray,butforoptimalflexibilityyoucanstartanywhereintherowdata.

Thefirststepistoscanthedumpfiletofindtheoffsetsandthesqlstatements.Eachoutputlinestartswiththeoffsetwheretheitemisfound.

 

DUL> scandumpfileexpdat.dmp;

0:CSET:1(US7ASCII)               #Charactersetinfofromtheheader

3:SEALEXPORT:V10.02.01            #theSeal-theexpversiontag

20:DBASYSTEM                      #expdoneasSYSTEM

8461:CONNECTSCOTT                 #sectionforuserSCOTT

8475:TABLE"EMP"

                                    #completecreatetablestaement

8487:CREATETABLE"EMP"("EMPNO"NUMBER(4,0),"ENAME"VARCHAR2(10),

"JOB"VARCHAR2(9),"MGR"NUMBER(4,0),"HIREDATE"DATE,"SAL"NUMBER(7,2),

"COMM"NUMBER(7,2),"DEPTNO"NUMBER(2,0)) PCTFREE10PCTUSED40

INITRANS1MAXTRANS255STORAGE(INITIAL65536FREELISTS1

FREELISTGROUPS1BUFFER_POOLDEFAULT)TABLESPACE"USERS"LOGGINGNOCOMPRESS

 

                                    #Insertstatement

8829:INSERTINTO"EMP"("EMPNO","ENAME","JOB","MGR","HIREDATE",

"SAL","COMM","DEPTNO")VALUES(:1,:2,:3,:4,:5,:6,:7,:8)

 

                                    #BINDinformation

8957:BINDinformationfor8columns

col[ 1]type2maxlength22

col[ 2]type1maxlength10cset31(WE8ISO8859P1)form1

col[ 3]type1maxlength9cset31(WE8ISO8859P1)form1

col[ 4]type2maxlength22

col[ 5]type12maxlength7

col[ 6]type2maxlength22

col[ 7]type2maxlength22

col[ 8]type2maxlength22

Conventionalexport                 #ConventionalmeansNOTDIRECT

 

9003:startoftabledata           #Herebeginsthefirstrow

Nowbuildanunexpstatementfromthecreatetablestatementandthedirect/conventionalinformationandthestartofthecolumndata.

 

UNEXPTABLE"EMP"("EMPNO"NUMBER(4,0),"ENAME"VARCHAR2(10),

"JOB"VARCHAR2(9),"MGR"NUMBER(4,0),"HIREDATE"DATE,"SAL"NUMBER(7,2),

"COMM"NUMBER(7,2),"DEPTNO"NUMBER(2,0))

dumpfileexpdat.dmpfrom9003;

 

Unloaded14rows,endoftablemarkerat9670#sowehaveourfamous14rows

 

 

 

ThisbuildsthenormalSQL*Loaderfileandamatchingcontrolfile.

Intheoutputfileoneextracolumnisadded,thisisrelatedtothe

statusoftherow.APmeanstherowisPartial,(somecolumnsmissing)

RmeansResynch,itisthefirstrowafteraresynchronisation.

OmeansOverlap,thepreviousrowhaderrors,butthenewrow

partlyoverlapstheotherone.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐