DUL User's and Configuration Guide V9.1.0.0

zhaozj2021-02-16  60

DUL User's And Configuration Guide V9.1.0.0 Oracle Confidential Dul and this documentation is Oracle Confidential and for Internal Use ONLY.

Table of contents Principles and feature list Setting Up and Using DUL Configuration Files Data Dictionary available No Data Dictionary UNLOAD statement overview Output format Some DUL internals DDL - DUL Dump Language specification DDL description DUL startup behaviour Configuring DUL DUL paramater file: init.dul Port specific Parameters Control File: Control.dul Sample Unload Sessions Data Dictionary Available Without Data Dictionary Incorrect Init.dul Parameters SQL * Loader Problems and Work Arounds Script To unload Data Dictionary

DUL's PRINCIPLES and FEATURE LIST STANDALONE C-PROGRAM DUL is a standalone C program that directly retrieves rows from tables in data files. The Oracle RDBMS software is NOT used at all. DUL does dirty reads, it assumes that every transaction is committed. Nor does IT CHECK / Require That Media Recovery Has Been Done.

Last Resort DUL IS INTENDED TO RETRIEVE DATA That Cannot Be Retrieved OtherWise. It is not an alternative for exp, sql * plus etc. It is meant to be a last resort, not for normal production usage.

Before you use DUL you must be aware that the rdbms has many hidden features to force a bad database open. Undocumented init.ora parameters and events can be used to skip roll forward, to disable rollback and more.

DATABASE CORRUPT - BLOCKS OK The database can be corrupted, but an individual data block used must be 100% correct During all unloading checks are made to make sure that blocks are not corrupted and belong to the correct segment If during a scan a bad.. block is encountered, an error message is printed in the loader file and to standard output. Unloading will continue with the next row or block.ROWS in CLUSTERS / TABLES / INDEXES DUL can and will only unload table / cluster data. It will NOT dump triggers, stored procedures nor create scripts for tables or views. (But the data dictionary tables describing them can be unloaded). The data will be unloaded in a format suitable for SQL * Loader or IMP. A matching control file for SQL * Loader is Generated as well.

DUL CAN UNLOAD INDES. INDEX UNLOAD TABLES. INDETERMINE HOW MANY ROWS A TABLE SHOULD ROWS.

CROSS PLATFORM UNLOADINGCross-platform unloading is supported The database can be copied from a different operating system than the DUL-host (Databases / systems done so far:.. Sequent / ptx, Vax Vms, Alpha Vms, MVS, HP9000 / 8xx, IBM AIX, SCO UNIX, Alpha OSF / 1, Intel Windows NT.

. 店..............

Robust Dul Will NOT DUMP, Spin or HANG No Matter How Badly Corrupted The Database IS.

(NEARLY) ALL ORACLE FEATURES SUPPORTEDFull support for all database constructs: row chaining, row migration, hash / index clusters, longs, raws, rowids, dates, numbers, multiple free list groups, segment high water mark, NULLS, trailing NULL columns, and unlimited extents, new block layout of Oracle8, partitioned tables.SUPPORTED RDBMS vERSIONS DUL should work with all versions 6 and 7. DUL has been tested with versions from 6.0.26 up to 7.3.2 and 9.0.1. Even the old block Header Layout (pre 6.0.27.2) is supported.

MULTI BYTE SUPPORT DUL is essentially a single byte application. The command parser does not understand multi byte characters, but it is possible to unload any multi byte database. For all possible caveats there is a work around.

RESTRICTIONS MLSLABELS MULTI level security lables of trusted Oracle Are Not Supported.

(Long) Raw Dul Can Unload (long) Raws, But There is no way to reload these 1-to-1 with sql * loader. There is no suitable format in SQL * LOADER TO PRESERVE All Long Raws. Use the export mode instead Or Write a Pro * C Program to load the data.

Oracle8 Object Option and Lobs Varrays, Objects, And Nested Tables Are Not Yet Supported. Lobs Are Only Supported in Sql * Loader Mode.

Portable DUL CAN Be Ported to any Operating System with an ANSI-C Compiler. DUL HAS BEEN PORTED to MANY UNIX VARIANTS, VMS AND WindowsNT.

RDBMS INTERNALS A good knowledge of the Oracle RDBMS internals is a pre requisite to be able to use DUL successfully. For instance the Data Server Internals (DSI) courses give a good foundation. There is even a module dedicated to DUL

SETTING UP and USING DULCONFIGURATION FILES There are two configuration files for DUL. "Init.dul" contains all configuration parameters. (Size of caches, details of header layout, oracle block size, output file format) In the control file, "control. dul ", the data file names and the oracle file numbers must be specified.DATA DICTIONARY AVAILABLEThe Oracle data dictionary is available if the data files which made up the SYSTEM TableSpace are available and useable. The number which Oracle assigned to these files and the name you have given them, which does not have to be the original name which Oracle knew, must be included in the "control.dul" file. you also need to eventually include the file numbers and names of any files from other TableSpaces for which you Wish to Eventually Unload Tables and Their Data. The lack of inclusion of these Files Will NOT Affect The Data Dictionary Unload Step But It Will Affect Later Table Unloading.

USING DUL WHEN USER $, OBJ $, TAB $ AND COL $ CAN BE Unloadedsteps to Follow:

configure DUL for the target database. This means creating a correct init.dul and control.dul. The SYSTEM TableSpace's data file numbers and names must be included within the control.dul file along with any data files for TableSpaces from which you wish to unload . TABLEs and their data for Oracle8 and higher the tablespace number and the relative file number must be specified for each datafile Use the "BOOTSTRAP;". command to prepare for unloading The bootstrap process will find a compatibility segment, find the bootstrap $ table. unload The old "dul dictv7.ddl" re no longer needed Unload the tables for which data files have been included within the "control.dul" file Use one of the following commands: "UNLOAD TABLE owner.table; (do not.. forget the semicolon) This will unload the one table definition and the table's data "UNLOAD USER user name;. This unloads all tables and data for the specified user". UNLOAD DATABASE; This unloads all of the database tables available (except the. user SYS). NO DATA DICTIONARY AVAILABLEIf data files are not available for the SYSTEM TableSpace the unload can still continue but USER, TABLE and COLUM names will not be known. Identifying the tables can be an overwhelming task. But it can be (and has been) done. You need in depth knowledge about your application and the application tables. column types can be guessed by DUL, but table and column names are lost. Any old SYSTEM tablespace from the same database but weeks old can be of great help! ................................................ ..

configure DUL for the target database. This means creating a correct init.dul and control.dul. (See Port specific parameters). In this case control.dul file will need the numbers and names of datafiles from which TABLEs and data will be unloaded but it does not require the SYSTEM TableSpace's information SCAN DATABASE;:. scan the database, build extent and segment map SCAN TABLES; or SCAN eXTENTS;: gather row statistics Identify the lost tables from the output of step 3. UNLOAD the identified tables. AUTOMATED SEARCHTo ease the hunt for the lost tables:. the scanned statistical information in seen_tab.dat and seen_col.dat can be loaded into a fresh database If you recreate the tables (Hopefully the create table scripts are still available) then structure information of a "Lost" Table Can Be Matched to the "Seen" Tables Scanned Information with Two SQL * Plus Scripts. (Fill.sql and getLost.sql).

HINTS AND PITFALLSNames are not really relevant for DUL, only for the person who must load the data. But the unloaded data does not have any value, if you do not know from which table it came. The guessed column types can be wrong. Even though the algorithm is conservative and decides UNKNOWN if not sure. trailing NULL columns are not stored in the database. So if the last columns only contain NULL's than the scanner will nOT find them. (During unload trailing NULL columns are handled correctly). When a table is dropped, the description is removed from the data dictionary only. The data blocks are not overwritten unless they are reused for a new segment. So the scanner software can see a table that has been dropped. Tables without rows will go unnoticed. Newer objects have a higher object id than older objects. If an table is recreated, or if there is a test and a production version of the same table the object id can be used to decide.DDL (DUL Description Language) UNLOAD STATEMENT OV ERVIEW DUL uses an SQL like command interface. There are DDL statements to unload extents, tables, users or the entire database. Data dictionary information required can be specified in the ddl statements or taken from the previously unloaded data dictionary. The following three statements will Unload the dept table. The Most Common Form Is If The Data Dictionary and the Extent Map Are Available:

Unload Table Scott.dept;

All Relevant Information Can Be Specified in The Statement As Well:

Rem Columns with Type in The Correct ORDER Rem The Segment Header LoAction In The Storage Clause Unload Table Dept (Deptno Number, DName Char, LOC Char) Storage (File 1 Block 1205);

Oracle Version 6:

REM version 6 data blocks have segment header location in each block ALTER SESSION SET USE_SCANNED_EXTENT_MAP = TRUE; UNLOAD TABLE dept (deptno NUMBER, dname CHAR, loc CHAR) STORAGE (EXTENTS (FILE 1 BLOCK 1205)); Oracle7:

Rem Oracle7 Data Blocks Have Object ID in Each Block

Alter session set use_scanned_extent_map = true; unload table dept (deptno number, dname char, loc char) Storage (Objno 1501);

Dul's Output Format. There Are Three DiffERENT MODES OF OUTPUT FORMAT.

Export mode SQL * Loader mode: stream data files SQL * Loader mode: Fixed physical record data files EXPORT MODEExport mode is a feature available only in DUL version 3 or DUL8 To enable export mode, you must set the init.dul parameter EXPORT_MODE to. True.

For each table a separate IMP loadable file will be generated. The generated file is completely different from a table mode export generated by EXP! The file is the minimal format that IMP can load. It is a single table dump file. With only an insert table statement and the table data. Table grants, storage clauses, or triggers will not be included. An minimal create table statement is included (no storage clause just column names and types without precision). The character set indication in the file in the generated Header is v6 style. It is set to mean ascii based characterSet.

Extreme care has been taken that the dump file can always be loaded with imp. Only complete good rows are written to the dump file. For this each row is buffered. The size of this buffer can changed with the init.dul parameter BUFFER. Incomplete OR Bad Rows Are Not Written Out.

SQL * LOADER MODESFor both SQL * Loader output formats the columns will be space separated and enclosed in double quotes. Any double quote in the data will be doubled. SQL * Loader recognizes this and will load only one. The character used to enclose the columns Can Be Changed from Double Quote To Any Character You Like with The Init.dul Parameter LDR_ENCLOSE_CHAR.THERE ARE TWO Styles of Physical Record Organization:

Stream ModeNothing special is done in stream mode, a newline is printed after each record. This is a compact format and can be used if the data does not contain newline characters. To enable stream mode set LDR_PHYS_REC_SIZE = 0 in init.dul.

Fixed Physical RecordsThis mode is essential if the data can contain newlines. One logical record, one comlete row, can be composed of multiple physical records. The default is record length is 81, this fits nicely on the screen of a VT220. The physical record Size Can Be Specified with ldr_phys_rec_size in init.dul.

OUTPUT FILE NAMESThe file names generated are:. Owner name_table name.ext The extension is ".dmp" for IMP loadable files ".dat" and ".ctl" are used for the SQL * Loader datafile and the control file To prevent.. Variable Substitution and Other Unwanted Side Effects, Strange Characters Are Stripped. (Only Alpha Numeric and '_' Are Allowed).

IF The File Parameter Is Set The Generated Names Will Be FilennN.ext. This Possibility Is A Work Around LONOUGH FILE NAMES.

Some DUL INTERNALS Required Information To Unload Table Data from A Database Block The Following Information Must Be Known:

Column / Cluster Information:... The number and type of the columns For char or varchar columns the maximum length as well The number of cluster columns and the table number in the cluster This information can be supplied in the unload statement or it can be taken from the previously unloaded USER $, OBJ $, TAB $ and COL $ segment / Extent information:. When unloading a table the extent table in the data segment header block is used to locate all data blocks The location of this segment header block. (file number and block number) is taken from the data dictionary or can be specified in the unload statement. If the segment header is not correct / available then another method must be used. DUL can build its own extent map by scanning the whole database . (in a separate run of DUL with the scan database statement.) BINARY hEADERS C-Structs in block headers are not copied directly, they are retrieved with specialized functions. All offsets of structure members are programmed into DUL. This approach makes it possible to cross-unload (Unload an MVS created data file on an HP) Apart from byte order only four layout types have been found so far.Vax VMS and Netware:.. No alignment padding between structure members Korean Ticom Unix machines: 16 bit alignment of structure members MS / DOS 16 bit alignment and 16 bit wordsize Rest of the world (Including Alpha VMS) structure member alignment on member size MACHINE DEPENDENCIES Machine dependencies (of the database) are configurable with parameters...:

ORDER OF BYTES IN A WORD (BIG / LITTLE Endian). Number of Bits for the Low Part of The File # in A DBA (Block Address). Alignment of Members in A C-Struct. Number of Blocks or Bytes Before The Oracle File header block. Size of a word used in the segment header structure. UNLOADING THE DATA DICTIONARY DUL can use the data dictionary of the database to be unloaded if the files for it exist and are uncorrupted. for the data dictionary to be used, internal tables must be unloaded first to external files:. (USER $, OBJ $, TAB $ and COL $) The bootstrap command will find and unload the required tables.DDL (DUL DESCRIPTION LANGUAGE) SPECIFICATION [ALTER SESSION] SET init.dul parameter = Value; Most Parameters Can Be Changed.

.... BOOTSTRAP [LOCATE | GENERATE | COMPLETE]; Bootstraps the data dictionary Default is COMPLETE LOCATE finds and unloads the bootstrap $ table GENERATE builds a ddl file based on inforation in the cache COMPLETE is in fact LOCATE, followed by GENRATE (two Times)

COMMIT; Writes The Changed Block to the data file.

Describe owner_name. Table_name;

Dump [TableSpace TableSpace_no] [file file_no] [block block_no] [Level Level_no]; NOTLETE BLOCKDUMP, Mainly Used For Debugging. The position is remembed for.

Rem any_text_you_like_till_end_of_line: Comment Not ALLOWED INSIDE DDL Statements. (To Avoid A Two Layer Lexical Scan).

Rollback; Cancels the Update Statements.

SHOW DBA dba; # dba -> file_no block_no calculator | DBA rfile_no block_no; # file_no block_no -> dba calculator | SIZES; # show some size of important structs | PARAMETER; # shows the values ​​of all parameters | LOBINFO; # lob indexes found WITH SCAN DATABASEUNLOAD DATABASE;

UNLOAD User User_Name;

UNLOAD TABLE [SCHEMA_NAME] TABLE_NAME [(Column_Definitions)] [cluster_clause] [storage_clause];

Unload extent Table_name [TABLESPACE TABLESPACE_NO] File Extent_Start_File_Number Block EXTENT_START_BLOCK_NUMBER Blocks Extent_Size_in Oracle_Blocks

UPDATE [block_address] SET UB1 | UB2 | UB4 @ offset_in_block = new_value; Now and then we can repair something Patches the current block and dumps it You can issue multiple UPDATE commands Block is not written yet, use COMMIT to write....

Storage_clause :: = storage (storage_specification [more_storage_specs])

storage_specification :: = OBJNO object_id_number | TABNO cluster_table_number | SEGOBJNO cluster / data_object_number / * v7 / v8 style data block id * / | FILE data_segment_header_file_number / * v6 style data block id * / BLOCK data_segment_header_block_number) | any_normal_storage_specification_but_silently_ignored

Scan Database; Scans All Blocks of All Data Files. Two Files Are Generated: 1: Seg.dat Information of Found Segment Headers: (Object ID, File Number, And Block Number). 2: EXT. dat information of contiguous table / cluster data blocks (object id (V7), file and block number of segment header (V6), file number and block number of first block, number of blocks, number of tables) SCAN TABLES;. Uses seg .dat and ext.dat as infut. Scans All Tables in All Data Segments (A Header Block and At Least One Matching Extent With At Least 1 Table).

SCAN EXTENTS; Uses seg.dat and ext.dat as infut. All Extens for Which No Corresponding Segment Header Has Been Found. (ONLY COMPLETE, OR A Segment Header is Corrupt).

EXIT Quit and Eof All Cause Dul to Terminate.

DDL (DUL DESCRIPTION LANGUAGE) DESCRIPTION Rules for UNLOAD EXTENT and UNLOAD TABLE: Extent MapUNLOAD TABLE requires an extent map In 99.99% of the cases the extent map in the segment header is available In the rare 0.01% that the segment header is lost.. AN Extent Mapse Command. The Self Build Extent Map Will Only BE Used During An Unload IF The Parameter Use_Scanned_EXTENT_MAP IS Set To True.

All data blocks have some ID of the segment they belong to. But there is a fundamental difference between V6 and V7. Data blocks created by Oracle version 6 have the address of the segment header block. Data blocks created by Oracle7 have the segment object id In The Header.

Column Specification The column definitions must be specified in the order the columns are stored in the segment, that is ordered by col $ .segcol #. This is not necessarily the same order as the columns where specified in the create table statement. Cluster columns are moved to the front, longs to the end. Columns added to the table with alter table command, are always stored last.Unloading a single extent UNLOAD EXTENT can be used to unload 1 or more adjacent blocks. The extent to be unloaded must be specified With the Storage Clause: To Specify A Single Extent Use: Storage (File Fn Block Bno Blocks #Blocks) (File and Block Specify The First Block, Blocks The size of the extent)

Dul Specific Column Types There Area Types:

Ignore: The Column Will Be Skipped As if it was at all. Unknown: a heuristic guess Will Be Made for Each Column. In Sql * Loader Mode There Arement:

HEXRAW: column is HEX dumped LOBINFO:. Show some information from LOB locators BINARY NUMBER:. Machine word as used in a LOB index Identifying USER $, OBJ $, TAB $ and COL $ There is a "hidden" trick with file and. object numbers that is used to locate the data dictionary tables. The trick is based on the fact that object numbers are fixed for OBJ $, COL $, USER $ and TAB $ due to the rigid nature of sql.bsq. This will not be Documented Because I myself Could Not Understand My First Attempt to Describe IT.

. DESCRIPTION OF SCAN COMMANDS SCAN TABLES and SCAN EXTENTS scan for the same information and produce similar output ALL columns of ALL rows are inspected For each column the following statistics are gathered.:

How often the column is seen in a data block. The maximum internal column length. How often the column IS NULL. How often the column consists of at least 75% printable ascii. How often the column consists of 100% printable ascii. How often the column is a valid oracle number. How often the column is a nice number. (not many leading or trailing zero's) How often the column is a valid date. How often the column is a possible valid rowid. These statistics are combined and a column type is suggested. Using this suggestion five rows are unloaded to show the result. These statistics are dumped to two files (seen_tab.dat and seen_col.dat). There are SQL * Loader and SQL * Plus scripts available to automate a part of (Currently Known as the getlost option) .describe There IS A Describe Command. It Will Show The Dictionary Information for the Table, Available In Dul's Dictionary Cache.

DUL Startup Sequence During Startup Dul Goes THROUGH The FOLLOWING Steps:

the parameter file "init.dul" is processed. the DUL control file (default "control.dul") is scanned. Try to load dumps of the USER $, OBJ $, TAB $ and COL $ if available into DUL's data dictionary cache Try to load seg.dat and col.dat. Accept DDL-Statements Or Run The DDL Script Specified As First Arg.

DUL parameters to be specified in init.dul: ALLOW_TRAILER_MISMATCH BOOLEAN Strongly discouraged to use, will seldom produce more rows Use only if you fully understand what it means and why you want it skips the check for correct block trailer The blocks failing this... test are split of corrupt. But it saves you the trouble to patch some blocks. ALLOW_DBA_MISMATCH BOOLEAN Strongly discouraged to use, will seldom produce more rows. use only if you fully understand what it means and why you want it. Skips the check for correct block address. The blocks failing this test are probably corrupt. But it saves you the trouble to patch some blocks. ASCII2EBCDIC BOOLEAN Must (var) char fields be translated from EBCDIC to ASCII. (For unloading MVS database on a ASCII host) BUFFER NUMBER (bytes) row output buffer size used in both export and SQL * Loader mode. in each row is first stored in this buffer. Only complete rows without errors are written to the output file. COMPATIBLE NUMBER Database versi ON, Valid Values ​​Are 6, 7, 8 or 9. This Parameter Must Be Specified Control_File Text Name of The DUL Control File (Default: "Control.dul"

). DB_BLOCK_SIZE NUMBER Oracle block size in bytes (Maximum 32 K) DC_COLUMNS NUMBER DC_OBJECTS NUMBER DC_TABLES NUMBER DC_USERS NUMBER Sizes of dul dictionary caches. If one of these is too low the cache will be automatically resized. EXPORT_MODE BOOLEAN EXPort like output mode or SQL * Loader format FILE TEXT Base for (dump or data) file name generation. Use this on 8.3 DOS like file systems FILE_SIZE_IN_MB NUMBER (Megabytes) Maximum dump file size. dump files are split into multiple parts. Each file has a complete header and can be loaded individually. LDR_ENCLOSE_CHAR TEXT The character to enclose fields in SQL * Loader mode. LDR_PHYS_REC_SIZE NUMBER Physical record size for the generated loader datafile. LDR_PHYS_REC_SIZE = 0 No fixed records, each record is terminated with a newline. LDR_PHYS_REC_SIZE>

2:... Fixed record size MAX_OPEN_FILES Maximum # of database files that are concurrently kept open at the OS level OSD_BIG_ENDIAN_FLAG Byte order in machine word Big Endian is also known as MSB first DUL sets the default according to the machine it is running on. . For an explanation why this is called Big Endian, you should read Gullivers Travels. OSD_DBA_FILE_BITS File Number size in DBA in bits. Or to be more precise the size of the low order part of the file number. OSD_FILE_LEADER_SIZE bytes / blocks added before the real oracle file header block OSD_C_STRUCT_ALIGNMENT C Structure member alignment (0,16 or 32). The default of 32 is correct for most ports. OSD_WORD_SIZE Size of a machine word always 32, except for MS / DOS (16) PARSE_HEX_ESCAPES Boolean default FALSE Use // xhh hex escape sequences in strings while parsing. If set to true then strange characters can be specified using escape sequences. This feature is also for specifying multi-byte characters. USE_SCANNED_EXTENT_MAP BOOLE AN Use the scanned extent map in ext.dat when unloading a table. The normal algorithme uses the extent map in the segment header. This parameter is only useful if some segment headers are missing or incorrect. WARN_RECREATE_FILES BOOLEAN (TRUE) Set to FALSE to suppress the warning message if an existing file is overwritten. WRITABLE_DATAFILES BOOLEAN (FALSE) Normal use of DUL will only read the database files. However the UPDATE and the SCAN RAW DEVICE will write as well. The parameter is there to prevent accidental damage. SAMPLE Init.dul:

# Sample init.dul configuration parameters # these must be big enough for the database in question # the cache must hold all entries from the dollar tables.dc_columns = 200000dc_tables = 10000dc_objects = 10000dc_users = 40 # OS specific parametersosd_big_endian_flag = falseosd_dba_file_bits = 10osd_c_struct_alignment = 32osd_file_leader_size = 1

# Database parametersdb_block_size = 8k

# loadinger format definitionsldr_enclose_char = "ldr_phys_rec_size = 81

Configuring the port dependent parameters osd_big_endian_flag big endian or little endian (byte order in machine words): HP, SUN and mainframes are generally big endian:. OSD_BIG_ENDIAN_FLAG = TRUE DEC and Intel platforms are little endian:. OSD_BIG_ENDIAN_FLAG = FALSE The default is correct for The Platform Where Dul is Running on.

The Following Might Work On A Unix System:

Echo dul | od -x if the output is like: 0000006 6475 6C0A 0000004 You are ON A BIG Endian Machine (OSD_BIG_ENDIAN_FLAG = TRUE).

IF you see: 000000000 7564 0A6C 0000004 This is a little endian machine (OSD_BIG_ENDIAN_FLAG = FALSE).

OSD_DBA_FILE_BITS The Number of Bits in A DBA Used for the Low Order Part of File Number. Perform The Following Query:

SQL> Select Dump (ChartorowId ('0.0.1')) from Dual; TYP = 69 LEN = 6: 8, 0, 0, 0, 0 -> OSD_DBA_FILEBITS = 5 (SCO) TYP = 69 LEN = 6: 4, 0, 0, 0, 0-> OSD_DBA_FILEBITS = 6 (sequence, hp) TYP = 69 LEN = 6: 1,0,0,0,0,0 -> OSD_DBA_FILEBITS = 8 (NCR, AIX) TYP = 69 LEN = 6: 0,16,0,0,0-> OSD_DBA_FILEBITS = 12 (mvs) TYP = 69 LEN = 10: 0, 0, 0, 0, 0, 64, 0, 0, 0, 0 osd_dba_filebits = 10 (Oracle8) OSD_C_STRUCT_ALIGNMENT Structure layout in data file headers 0:. No padding between members in a C-struct (VAX / VMS only) 16: Some korean ticom machines and MS / DOS 32: Structure members are member size aligned (All Others Including Alpha / VMS) Check The Following Query:

Select * from V $ TY_SIZEWHERE TYPE IN ('KCBH', 'KTNO', 'KTBH', 'KTBH', 'KTBIT', 'KTBH', 'KTECT', 'KTETB', 'KTSHC';

In General OSD_C_STRUCT_ALIGNMENT = 32 and the folowing output is expected:

K KTNO TABLE NUMBER IN CLUSTER 1KCB KCBH BLOCK COMMON HEADER 20KTB KTBIT TRANSACTION VARIABLE HEADER 24KTB KTBBH TRANSACTION FIXED HEADER 48KDB KDBH DATA HEADER 14KTE KTECT EXTENT CONTROL 44KTE KTETB EXTENT TABLE 8KTS KTSHC SEGMENT HEADER 8

Rows SELECTED.

For vax / vms and netware only osd_c_struct_alignment = 0 and this output is expected:

Componen Type Description Size -------------------------------------------- - ---------- K KTNO TABLE NUMBER IN CLUSTER 1KCB KCBH BLOCK COMMON HEADER 20KTB KTBIT TRANSACTION VARIABLE HEADER 23KTB KTBBH TRANSACTION FIXED HEADER 42KDB KDBH DATA HEADER 14KTE KTECT EXTENT CONTROL 39KTE KTETB EXTENT TABLE 8KTS KTSHC SEGMENT HEADER 78 Rows SELECTED.

If there is a different list this will request and possibly a major change to dul. (Email bduijnen@nl.oracle.com)

osd_file_leader_size Number of blocks / bytes before the oracle file header. Unix datafiles have an extra leading block (file size, block size magic number) A large number (> 100) is seen as a byte offset, a small number is seen as a number ORACLE blocks.

Unix: osd_file_leader_size = 1Vms: osd_file_leader_size = 0Desktop: osd_file_leader_size = 512Others: Unknown (Use Andre Bakker's famous PATCH utility to find out) An Oracle7 file header block starts with the pattern 0X0B010000.

You can add an addressal byte offset in control (for instance for aix or) on data files on raw device)

Control File Specification A Control File (Default Name "Control.dul") Is Used to Translate The File Numbers To File Names. The Format of The Control Has Been Extended:

if COMPATIBLE is 6 or 7: control_file_line_for_6_or_7 :: = file_number data_file_name [optional extra leader offset] [startblock block_no] [endblock block_no] If COMPATIBLE is 8 or higher: control_file_line_for_8 :: = tablespace_no relative_file_number data_file_name [optional extra leader offset] [startblock block_no ] [Endblock block_no]

Each entry on a separate line. The optional extra leader offset is an extra byte offset, that will be added to all lseek () operations for that datafile. This makes it possible to skip over the extra block for AIX on raw devices.

.

For instance:

# AIX Version 7 Example With One File on Raw Device 1 /usr/oracle/dbs/system.dbf 8 /dev/rdsk/data.dbf 4096

# Oracle8 example with a datafile split in multiple parts, each part smaller than 2GB 0 1 /fs1/oradata/PMS/system.dbf 1 2 / tmp / huge_file_part1 startblock 1 endblock 1000000 1 2 / tmp / huge_file_part2 startblock 1000001 endblock 2000000 1 2 / mnt3 / huge_file_part3 startblock 2000001 Endblock 2550000

The File Header Blocks Are Not Verified. This Would Make IT Impossible To Unload Files with a Corrupted Header Block. For debugging it is possible to dump the file header.

Sample unload session: data dictionary usable for DUL create a suitable "init.dul" create a control.dul sqlplus / nolog connect / as sysdba startup mount set trimspool on pagesize 0 linesize 256 feedback off column name format a200 spool control.dul select ts #, RFILE #, Name from V $ dataFile; Exitedit The Resultfor Oracle8 A Different Query Must Be Used: Select TS #, RFILE #, Name from V $ DataFile;

DUL DICTV7.DDL $ DUL DICTV7.DDL

UnLoader:.. Version 2.0.0.0 - Very Restricted on Tue May 16 11:04:12 1995Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved .. unloading table OBJ $ 1487 rows unloaded unloading table TAB $ 197 rows Unloaded. Unloading Table User $ 13 ROWS Unlined

restart dul UnLoader:. Version 2.0.0.0 - Very Restricted on Tue May 16 11:05:00 1995Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved.Loaded 1487 objectsLoaded 197 tablesLoaded 5566 columnsLoaded 13 usersDUL> unload table scott .emp; About to unloading scott's table .... unloading Table EMP 14 ROWS UnloadedDUL>

Example unload session: data dictionary UNUSABLE for DUL create a suitable "init.dul" (See config guide) create a control.dul See above scan the database for segment headers and extents: $ dulUnLoader: Version 2.0.0.0 - Very Restricted on Tue May 16 11:10:16 1995Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved.DUL> scan database;. data file 1 20480 blocks scanneddata file 4 7680 blocks scanneddata file 5 512 blocks scannedDUL> quit

Restart Dul and Scan The Found Tables for Column Statistics This Creates A huge Amount of output: echo scan tables /; | dul> scan.out & [man lines here]

Object ID 1601 Table Number 0unload Table T1601_0 (C1 Number, C2 Unknown, C3 Unknown, C4 Number, C5 Date, C6 Number, C7 Number, C8 Number) Storage (tabno 0 extents);

Colno Seen Maxintsz NULL% C75% C100 NUM% 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" "7902" "17-DEC-1980 AD 00:00" "800" "" 20 "

"7499" "-0.00002525323" "Salesman" "7698" "20-Feb-1981 AD 00:00:00" "1600" "30

0 "30"

"7521" "Ward" "Salesman" "7698" 22-Feb-1981 AD 00:00:00 "1250" "500" "30"

"7566" "Jones" "Manager" "7839" "02-APR-1981 AD 00:00:00" "2975" "" 20 "

"7654" "Martin" "Salesman" "7698" "28-Sep-1981 AD 00:00:00" "1250" "1400" "30"

[Many More Lines HERE]

This Looks Familiar, Use The Above Information and your Knowledge of the Emp Table To Compose:

UNLOAD TABLE emp (empno number, ename char, job char, mgr number, hiredate date, sal number, comm number deptno number) STORAGE (TABNO 0 EXTENTS (FILE 1 BLOCK 10530)); use this statement to unload emp: $ dulUnLoader: Version 2.0.0.0 -. Very Restricted on Tue May 16 11:46:33 1995Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved.Loaded 350 segmentsLoaded 204 extentsExtent map sortedDUL> UNLOAD TABLE emp (empno number, ename char , Job Char, Mgr Number, DUL 2> Hiredate Date, Sal Number, Comm number Deptno Number) DUL 3> Storage (Tabno 0 Extents (File 1 Block 10530) ;. Unloading Table EMP 14 ROWS UnloadedDul> quit

Example unload session: Incorrect init.dul ParametersWRONG osd_dba_file_bits size This can generate output similar to below Normally this should not happen since you should create a demo database and check this via the DUL documented (in html page) query..

The Mismatch in DBA's is Only In The File Number (First Number In Brackets) Part. The Second Number, The Block Number, IS CORRECT.

Data UnLoader: Release 3.2.0.1 - Internal Use Only - on Wed Sep 3 10:40:33 1997Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved.Session altered.Session altered.Session altered.Session altered.. Session Altered.dul: Warning: Block [1] [2] DBA IN Block Mismatch [4] [2] DUL: WARNING: BAD Cache Layer Header File # = 1, Block # = 2

DUL: WARNING: Block [1] [3] DBA IN Block Mismatch [4] [3] DUL: WARNING: BAD Cache Layer Header File # = 1, Block # = 3

........... and etc ........

WRONG osd_file_leader_size This may create output similar to below, but many other flavours are possible In this case we are a fixed number of blocks off The file number is correct The difference in the block numbers is constant.:Data UnLoader:... Release 3.2 .0.1 - Internal Use Only -. on Wed Sep 3 10:44:23 1997Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved.Session altered.Session altered.Session altered.Session altered.Session altered.

DUL: WARNING: Block [1] [2] DBA IN Block Mismatch [1] [3] DUL: WARNING: BAD Cache Layer Header File # = 1, Block # = 2

DUL: WARNING: Block [1] [3] DBA IN Block Mismatch [1] [4] DUL: WARNING: BAD Cache Layer Header File # = 1, Block # = 3

........... and etc ........

WRONG OSD_C_STRUCT_ALIGNMENT THIS. GENERATE OUTPUT Similar To The Following:

Data UnLoader: Release 3.2.0.1 - Internal Use Only - on Wed Sep 3 10:46:10 1997Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved.Session altered.Session altered.Session altered.Session altered.. Session altered .. unloading Table Obj $

DUL: WARNING: FILE # 0 is out of rangedul: Warning: Cannot Read Data Block File # = 0, Block # = 262145OS Error 2: No Such File or Directory

DUL: WARNING: FILE # 0 is out of rangingDul: Warning: Cannot Read Data Block File # = 0, Block # = 262146os error 2: No Such File or Directory

........... and etc ........

WRONG DB_BLOCK_SIZE

The following output was generated when the db_block_size was set toosmall. The correct value was 4096 and it was set to 2048. Normally, thevalue for this parameter should be taken from the Oracle instances's init.orafile and will not be correctly set.

Data UnLoader: Release 3.2.0.1 - Internal Use Only - on Thu Sep 4 12:38:25 1997Copyright (c) 1994/95 Oracle Corporation, The Netherlands All rights reserved.Session altered.Session altered.Session altered.Session altered.. Session Altered.dul: Warning: Block [1] [2] DBA IN Block Mismatch [513] [1159680] DUL: WARNING: FILE = 1, Block 2: Illegal Block Version 2dul: Warning: Block [1] [2] ILLEGAL Block type [0] DUL: WARNING: BAD Cache Layer Header File # = 1, Block # = 2dul: Warning: Block [1] [4] DBA IN Block Mismatch [1] [2] DUL: WARNING: FILE [1] Block [4] incseq mismatch [90268! = 0] DUL: WARNING: BAD Cache Layer Header File # = 1, Block # = 4

DUL: WARNING: Block [1] [6] DBA IN Block Mismatch [1] [3] DUL: WARNING: FILE [1] Block [6] incseq mismatch [139591710! = 86360346] DUL: WARNING: BAD Cache Layer Header File # = 1, block # = 6

........... and etc ........

Quote Missing

If you get the following error it is caused by the data dictionary tables "USER $, OBJ $, TAB $ and COL $" not being correctly generated. Tofix this error simply delete all dictv6.ddl or dictv7.ddl created .datand .ctl FILES AND RESTART.

Data Unloader: Release 3.2.0.1 - Internal Uses ONLY - ON WED SEP 3 10:49:30 1997 Copyright (C) 1994/95 Oracle Corporation, The Netherlands. All Rights Reserved.dul: Error: Quote Missing

SQL * Loader problems and work arounds 233827 LOADER REJECTS MULTI-LINE RECORDS IF USING 'TERMINATED BY WHITESPACE' DESCRIPTION: Load of multi line records fails if the continuation is between columns WORK AROUND:. Use larger physical records (init.dul: LDR_PHYS_REC_SIZE) FIXED: 7.3 250325 CAN nOT LOAD CHAR tHAT'S USED AS eNCLOSING CHARACTER DESCRIPTION: The stutter syntax of a column that starts with an enclosing character is not parsed correctly ( "" "string itself enclosed in quotes" "" is not parsed correctly) WORK.. AROUND: Use other enclosing character (init.dul: LDR_ENCLOSE_CHAR). FIXED: 7.1.6Script to unload USER $, OBJ $, TAB $ and COL $ REM DDL Script to unload the dictionary cache for DUL V3 (Oracle 7) REM force the settings, so I know what happensalter session set export_mode = false; alter session set ldr_phys_rec_size = 0; alter session set ldr_enclose_char = "" ""; alter session set file = ""; alter session set max_unload_blocks = 0; alter session set blocks_to_skip = 0;

Unload Table Obj $ (Obj # Number, Owner # Number, Name Varchar2 (30), Namespace Ignore, Type Number Storage (Objno 17 File 1);

Unload Table Tab $ (Obj # Number, TS # Ignore, File # Number, Block # Number, Clu # ignore, tab # number );

unload table COL $ (OBJ # number, COL # number, SEGCOL # number, SEGCOLLENGTH ignore, OFFSET ignore, NAME char (30), TYPE # number, LENGTH number) cluster C_OBJ # (OBJ #) storage (tabno 5 segobjno 1 file 1);

Unload Table User $ (User # Number, Name Varchar2 (30)) Cluster C_USER # (User #) Storage (Tabno 1 Segobjno 9 File 1); Rem Restart and Load The Dictinary In The Cacheexit

Bernard van duijnen (bduijnen.nl)

转载请注明原文地址:https://www.9cbs.com/read-20808.html

New Post(0)