在某些情况下,如果没有物理备份,只要逻辑的导出备份,需要进行恢复时,发现dmp文件又损坏了,通常来讲是比较悲剧的。针对这样的极端情况,Oracle DUL是可以经常支持的(目前ODU尚未支持)。
如下是我的一些简单的测试,供参考!
##### 测试DUL是否支持抽取exp的dmp
当使用scan dump file扫描完exp的dmp文件之后,最后是讲scan的数据输出到文件,方便查看,然后可以直接抽取我们需要的表,如下:
使用unexp命令抽取之后,最后需会产生2个文件,其中是一个sqlldr的ctl文件,最后我们通过sqlldr讲数据加载到数据库即可。如下:
当测试完DUL的exp dmp支持之后,我比较好奇是否会支持expdp呢? 如下是测试过程!
###### 测试DUL是否支持expdp
下面我们来测试,Oracle DUL是否支持expdp的dmp文件的抽取。
++++使用unpump命令查看dmp文件头信息
这里需要注意的是,scan的结果有10条,表示这个expdp的dmp文件中包含了10个表的内容,如果我只想抽取之前的一个表怎么办呢? 可以结合expdp的日志来进行判断,或者利用strings来确认。
这里假设我想抽取第一个表的数据:
上面的结果中,最为关键的一行是:Table data from 94872 until 77916680
根据这行结果,我们知道该表的offset为94872到 77916680,因此下面根据偏移量来抽取该表的数据:
我们可以看到,目前DUL 算是比较完美的支持了exp和expdp 的dmp。(我测试过程中遇到了一些其他的状况,这里不描述了)。
如下是我的一些简单的测试,供参考!
##### 测试DUL是否支持抽取exp的dmp
[oracle@10gasm dul]$ ./dul
Data UnLoader: 10.2.0.5.32 - Internal Only - on Sun Aug 17 04:45:52 2014
with 64-bit io functions
Copyright (c) 1994 2014 Bernard van Duijnen All rights reserved.
Strictly Oracle Internal Use Only
DUL: Warning: Recreating file "dul.log"
Reading USER.dat 59 entries loaded
Reading OBJ.dat 50948 entries loaded and sorted 50948 entries
Reading TAB.dat 1586 entries loaded
Reading COL.dat 55063 entries loaded and sorted 55063 entries
Reading TABPART.dat 85 entries loaded and sorted 85 entries
Reading TABCOMPART.dat 0 entries loaded and sorted 0 entries
Reading TABSUBPART.dat 0 entries loaded and sorted 0 entries
Reading INDPART.dat 93 entries loaded and sorted 93 entries
Reading INDCOMPART.dat 0 entries loaded and sorted 0 entries
Reading INDSUBPART.dat 0 entries loaded and sorted 0 entries
Reading IND.dat 2236 entries loaded
Reading LOB.dat 529 entries loaded
Reading ICOL.dat 3658 entries loaded
Reading COLTYPE.dat 1688 entries loaded
Reading TYPE.dat 1885 entries loaded
Reading ATTRIBUTE.dat 7051 entries loaded
Reading COLLECTION.dat 551 entries loaded
Reading BOOTSTRAP.dat 57 entries loaded
Reading LOBFRAG.dat 1 entries loaded and sorted 1 entries
Reading LOBCOMPPART.dat 0 entries loaded and sorted 0 entries
Reading UNDO.dat 21 entries loaded
Reading TS.dat 10 entries loaded
Reading PROPS.dat 27 entries loaded
Database character set is ZHS16GBK
Database national character set is AL16UTF16
Disk group DATA1, dul group_cid 0
Discovered disk /dev/sdd as diskgroup DATA1, disk number 0 size 1024 Mb File1 starts at 2, dul_disk_cid 0
Discovered disk /dev/sdc as diskgroup DATA1, disk number 1 size 1024 Mb without File1 meta data, dul_disk_cid 1
DUL: Warning: Dictionary cache DC_ASM_EXTENTS is empty
DUL: Error: Filedir block not allocated, file does not exist
DUL: Error: Could not load asm meta data for group DATA1 file 9
Oracle data file size 503324672 bytes, block size 8192
Found db_id = 2100824985
Found db_name = TEST
Oracle data file size 57679872 bytes, block size 8192
Oracle data file size 272637952 bytes, block size 8192
Oracle data file size 5251072 bytes, block size 8192
Oracle data file size 209723392 bytes, block size 8192
Oracle data file size 10493952 bytes, block size 8192
Oracle data file size 104865792 bytes, block size 8192
DUL> scan dump file /home/oracle/roger.dmp ;
0: CSET: 1 (US7ASCII)
3: SEAL EXPORT:V10.02.01
20: DBA ROGER
28: TYPE USERS
9103: CREATE CLUSTER "TEST_CLUSTER" ("OBJECT_ID" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 131072 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER"
9294: CREATE INDEX "TEST_CLUSTER_IDX_ID" ON CLUSTER "TEST_CLUSTER" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER"
9535: TABLE "AAA"
9547: CREATE TABLE "AAA" ("OWNER" VARCHAR2(30), "OBJECT_ID" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" LOGGING NOCOMPRESS
9767: INSERT INTO "AAA" ("OWNER", "OBJECT_ID") VALUES (:1, :2)
9824: BIND information for 2 columns
col[ 1] type 1 max length 30 cset 852 (ZHS16GBK) form 1
col[ 2] type 2 max length 22
Conventional export
9842: start of table data
9944: CREATE INDEX "AAA_ID_IDX" ON "AAA" ("OBJECT_ID" ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" LOGGING
10130: ALTER INDEX "AAA_ID_IDX" UNUSABLE
11159: TABLE "T"
11169: CREATE TABLE "T" ("OWNER" VARCHAR2(30), "OBJECT_NAME" VARCHAR2(128), "SUBOBJECT_NAME" VARCHAR2(30), "OBJECT_ID" NUMBER, "DATA_OBJECT_ID" NUMBER, "OBJECT_TYPE" VARCHAR2(19), "CREATED" DATE, "LAST_DDL_TIME" DATE, "TIMESTAMP" VARCHAR2(19), "STATUS" VARCHAR2(7), "TEMPORARY" VARCHAR2(1), "GENERATED" VARCHAR2(1), "SECONDARY" VARCHAR2(1)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" LOGGING NOCOMPRESS
11661: INSERT INTO "T" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY") VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13)
11920: BIND information for 13 columns
col[ 1] type 1 max length 30 cset 852 (ZHS16GBK) form 1
col[ 2] type 1 max length 128 cset 852 (ZHS16GBK) form 1
col[ 3] type 1 max length 30 cset 852 (ZHS16GBK) form 1
col[ 4] type 2 max length 22
col[ 5] type 2 max length 22
col[ 6] type 1 max length 19 cset 852 (ZHS16GBK) form 1
col[ 7] type 12 max length 7
col[ 8] type 12 max length 7
col[ 9] type 1 max length 19 cset 852 (ZHS16GBK) form 1
col[ 10] type 1 max length 7 cset 852 (ZHS16GBK) form 1
col[ 11] type 1 max length 1 cset 852 (ZHS16GBK) form 1
col[ 12] type 1 max length 1 cset 852 (ZHS16GBK) form 1
col[ 13] type 1 max length 1 cset 852 (ZHS16GBK) form 1
Conventional export
12014: start of table data
12811: ALTER TABLE "T" ADD SUPPLEMENTAL LOG GROUP "GGS_51357" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY") ALWAYS
18880: TABLE "T0521"
18894: CREATE TABLE "T0521" ("OWNER" VARCHAR2(30), "OBJECT_NAME" VARCHAR2(128), "SUBOBJECT_NAME" VARCHAR2(30), "OBJECT_ID" NUMBER, "DATA_OBJECT_ID" NUMBER, "OBJECT_TYPE" VARCHAR2(19), "CREATED" DATE, "LAST_DDL_TIME" DATE, "TIMESTAMP" VARCHAR2(19), "STATUS" VARCHAR2(7), "TEMPORARY" VARCHAR2(1), "GENERATED" VARCHAR2(1), "SECONDARY" VARCHAR2(1)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" LOGGING NOCOMPRESS
19390: INSERT INTO "T0521" ("OWNER", "OBJECT_NAME", "SUBOBJECT_NAME", "OBJECT_ID", "DATA_OBJECT_ID", "OBJECT_TYPE", "CREATED", "LAST_DDL_TIME", "TIMESTAMP", "STATUS", "TEMPORARY", "GENERATED", "SECONDARY") VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13)
19653: BIND information for 13 columns
col[ 1] type 1 max length 30 cset 852 (ZHS16GBK) form 1
col[ 2] type 1 max length 128 cset 852 (ZHS16GBK) form 1
col[ 3] type 1 max length 30 cset 852 (ZHS16GBK) form 1
col[ 4] type 2 max length 22
col[ 5] type 2 max length 22
col[ 6] type 1 max length 19 cset 852 (ZHS16GBK) form 1
col[ 7] type 12 max length 7
col[ 8] type 12 max length 7
col[ 9] type 1 max length 19 cset 852 (ZHS16GBK) form 1
col[ 10] type 1 max length 7 cset 852 (ZHS16GBK) form 1
col[ 11] type 1 max length 1 cset 852 (ZHS16GBK) form 1
col[ 12] type 1 max length 1 cset 852 (ZHS16GBK) form 1
col[ 13] type 1 max length 1 cset 852 (ZHS16GBK) form 1
Conventional export
19747: start of table data
20544: TABLE "T0727"
20558: CREATE TABLE "T0727" ("A" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" LOGGING NOCOMPRESS
20750: INSERT INTO "T0727" ("A") VALUES (:1)
20788: BIND information for 1 columns
col[ 1] type 2 max length 22
.......
Conventional export
93063204: start of table data
93063207: CREATE INDEX "IDX1_YZ_CLGC_ZMMD_BAK" ON "YZ_CLGC_ZMMD_BAK" ("MAIL_NO" ) PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING LOCAL(PARTITION "PART_131029" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131030" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131031" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131101" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131102" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131103" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131104" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131105" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131106" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131107" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131108" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_131109" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING, PARTITION "PART_MAX" PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "ROGER" NOLOGGING )
93293775: ENDPARTITION
93293788: ENDTABLE
93293814: CREATE SYNONYM "V$PARAMETER" FOR "SYS"."SHOW_HIDDEN_V$PARAMETER"
93294070: TABLE "TEST_KILLDB2"
93294091: ALTER TABLE "TEST_KILLDB2" ADD FOREIGN KEY ("OBJECT_ID") REFERENCES "TEST_KILLDB1" ("OBJECT_ID") ENABLE
93294195: ENDTABLE
93294681: TABLE "TEST_CLUSTER"
93294761: TABLE "AAA"
93294837: TABLE "T"
93294907: TABLE "TEST_ASM_READ"
93295013: TABLE "TEST_KILLDB1"
93295116: TABLE "TEST_KILLDB2"
93295219: TABLE "TTT"
93295295: TABLE "YZ_CLGC_ZMMD_BAK"
93295410: ENDTABLE
93295442: EXIT
93295447: EXIT
DUL>
当使用scan dump file扫描完exp的dmp文件之后,最后是讲scan的数据输出到文件,方便查看,然后可以直接抽取我们需要的表,如下:
DUL> unexp TABLE "ROGER"."T" ("OWNER" VARCHAR2(30), "OBJECT_NAME" VARCHAR2(128), "SUBOBJECT_NAME" VARCHAR2(30),
2 "OBJECT_ID" NUMBER, "DATA_OBJECT_ID" NUMBER, "OBJECT_TYPE" VARCHAR2(19), "CREATED" DATE, "LAST_DDL_TIME" DATE,
3 "TIMESTAMP" VARCHAR2(19), "STATUS" VARCHAR2(7), "TEMPORARY" VARCHAR2(1), "GENERATED" VARCHAR2(1), "SECONDARY" VARCHAR2(1))
4 dump file /home/oracle/roger.dmp from 12014;
Unloaded 9 rows, end of table marker at 12810
DUL>
使用unexp命令抽取之后,最后需会产生2个文件,其中是一个sqlldr的ctl文件,最后我们通过sqlldr讲数据加载到数据库即可。如下:
[oracle@10gasm dul]$ sqlplus roger/roger
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Aug 17 04:57:45 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(1) from t;
COUNT(1)
----------
9
SQL> truncate table t;
Table truncated.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@10gasm dul]$ sqlldr roger/roger control=dump000.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Sun Aug 17 04:58:26 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 9
[oracle@10gasm dul]$ sqlplus roger/roger
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Aug 17 04:58:31 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(1) from t;
COUNT(1)
----------
9
SQL> 当测试完DUL的exp dmp支持之后,我比较好奇是否会支持expdp呢? 如下是测试过程!
###### 测试DUL是否支持expdp
[oracle@10gasm ~]$ expdp roger/roger directory=ASM_TO_FS dumpfile=roger02.dmp
Export: Release 10.2.0.1.0 - Production on Sunday, 17 August, 2014 5:00:16
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
FLASHBACK automatically enabled to preserve database integrity.
Starting "ROGER"."SYS_EXPORT_SCHEMA_01": roger/******** directory=ASM_TO_FS dumpfile=roger02.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 120.5 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SYNONYM/SYNONYM
Processing object type SCHEMA_EXPORT/CLUSTER/CLUSTER
Processing object type SCHEMA_EXPORT/CLUSTER/INDEX
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "ROGER"."TTT" 74.22 MB 796592 rows
. . exported "ROGER"."TEST_BIG" 4.655 MB 49885 rows
. . exported "ROGER"."TEST_ASM_READ" 874.7 KB 10000 rows
. . exported "ROGER"."TEST_KILLDB1" 5.460 KB 13 rows
. . exported "ROGER"."TEST_KILLDB2" 5.937 KB 4 rows
. . exported "ROGER"."AAA" 5.320 KB 9 rows
. . exported "ROGER"."T" 9.335 KB 9 rows
. . exported "ROGER"."T0521" 9.335 KB 9 rows
. . exported "ROGER"."T0727" 4.929 KB 3 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131029" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131030" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131031" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131101" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131102" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131103" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131104" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131105" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131106" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131107" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131108" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_131109" 0 KB 0 rows
. . exported "ROGER"."YZ_CLGC_ZMMD_BAK":"PART_MAX" 0 KB 0 rows
Master table "ROGER"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for ROGER.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/arch/roger02.dmp
Job "ROGER"."SYS_EXPORT_SCHEMA_01" successfully completed at 05:00:55下面我们来测试,Oracle DUL是否支持expdp的dmp文件的抽取。
++++使用unpump命令查看dmp文件头信息
DUL> unpump header dump file /home/oracle/arch/roger02.dmp ;
Version is 257
check sum is 2743005495
data pump id is 6783164
master_obj_no is 52434
header blocks is 1
data pump file number is 1
block size is 4096
character set id is 852
master table block offset is 20449
(Master table is at byte offset (20449 -1) * 4096 = 83755008)
master table size is 306616
++++扫描expdp的dmp文件
DUL> unpump scan dump file /home/oracle/arch/roger02.dmp ;
Magic number found at offset 86016
Magic number found at offset 77918208
Magic number found at offset 82800640
Magic number found at offset 83697664
Magic number found at offset 83705856
Magic number found at offset 83714048
Magic number found at offset 83722240
Magic number found at offset 83734528
Magic number found at offset 83746816
Magic number found at offset 83755008
这里需要注意的是,scan的结果有10条,表示这个expdp的dmp文件中包含了10个表的内容,如果我只想抽取之前的一个表怎么办呢? 可以结合expdp的日志来进行判断,或者利用strings来确认。
这里假设我想抽取第一个表的数据:
DUL> unpump stream header dump file /home/oracle/arch/roger02.dmp from 86016 ;
magic number is 0xffff2424
version is 10
flags is 0x00
meta data length is 4758
relative meta data offset is 4096
table data length is 77821808
relative table data offset is 8856
granule length is 64
relative granule offset is 77830664
Table data from 94872 until 77916680
Meta data character set is 852, ZHS16GBK
1 0 3 2 ZHS16GBK AL16UTF16 +00:00 0000006001240F050B0C030C0C0504050D0609070805050505050F05050505050A050505050504050607080823432323081123081141B0230083035407D00300000000000000000000000000000000000000000000000000000000000000000000000000 51588 ROGER TTT 536870912 51588 1 1 1 14336 OWNER 1 30 0 852 1 30 51588 2 2 2 14336 OBJECT_NAME 1 128 0 852 1 128 51588 3 3 3 14336 SUBOBJECT_NAME 1 30 0 852 1 30 51588 4 4 4 14336 OBJECT_ID 2 22 0 0 0 0 51588 5 5 5 14336 DATA_OBJECT_ID 2 22 0 0 0 0 51588 6 6 6 14336 OBJECT_TYPE 1 19 0 852 1 19 51588 7 7 7 14336 CREATED 12 7 0 0 0 0 51588 8 8 8 14336 LAST_DDL_TIME 12 7 0 0 0 0 51588 9 9 9 14336 TIMESTAMP 1 19 0 852 1 19 51588 10 10 10 14336 STATUS 1 7 0 852 1 7 51588 11 11 11 14336 TEMPORARY 1 1 0 852 1 1 51588 12 12 12 14336 GENERATED 1 1 0 852 1 1 51588 13 13 13 14336 SECONDARY 1 1 0 852 1 1
|
DUL>上面的结果中,最为关键的一行是:Table data from 94872 until 77916680
根据这行结果,我们知道该表的offset为94872到 77916680,因此下面根据偏移量来抽取该表的数据:
DUL> unpump TABLE ROGER.TTT
2 (OWNER VARCHAR2(30), OBJECT_NAME VARCHAR2(128), SUBOBJECT_NAME VARCHAR2(30), OBJECT_ID NUMBER, DATA_OBJECT_ID NUMBER,
3 OBJECT_TYPE VARCHAR2(19), CREATED DATE, LAST_DDL_TIME DATE, TIMESTAMP VARCHAR2(19), STATUS VARCHAR2(7), TEMPORARY VARCHAR2(1), GENERATED VARCHAR2(1),
4 SECONDARY VARCHAR2(1)) dump file /home/oracle/arch/roger02.dmp from 94872 until 77916680;
DUL: Warning: Recreating file "dump000.ctl"
796592 rows unloaded
DUL> exit
Life is DUL without it
[oracle@10gasm dul]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Aug 17 05:57:46 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn roger/roger
Connected.
SQL> truncate table ttt;
Table truncated.
SQL> !
[oracle@10gasm dul]$ ls -ltr dump*
-rw-r--r-- 1 oracle oinstall 121674640 Aug 17 05:57 dump000.dat
-rw-r--r-- 1 oracle oinstall 1067 Aug 17 05:57 dump000.ctl
[oracle@10gasm dul]$ sqlldr roger/roger control=dump000.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Sun Aug 17 05:58:18 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 64
Commit point reached - logical record count 128
Commit point reached - logical record count 192
Commit point reached - logical record count 256
Commit point reached - logical record count 320
......
Commit point reached - logical record count 796470
Commit point reached - logical record count 796534
Commit point reached - logical record count 796592
[oracle@10gasm dul]$
[oracle@10gasm dul]$ exit
exit
SQL> select count(1) from ttt;
COUNT(1)
----------
796592
SQL>
我们可以看到,目前DUL 算是比较完美的支持了exp和expdp 的dmp。(我测试过程中遇到了一些其他的状况,这里不描述了)。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




