E:\>exp dbmon/dbmon file=e:\test\test.dmp tables=dh_sql,dh_stat
Export: Release 11.2.0.1.0 - Production on 星期二 6月 17 10:45:22 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集
即将导出指定的表通过常规路径...
. . 正在导出表 DH_SQL导出了 62613 行
. . 正在导出表 DH_STAT导出了 72612 行
成功终止导出, 没有出现警告。
E:\>imp dbmon/dbmon file=e:\test\test.dmp fromuser=dbmon touser=dh
Import: Release 11.2.0.1.0 - Production on 星期二 6月 17 10:48:57 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
经由常规路径由 EXPORT:V11.02.00 创建的导出文件
已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
. 正在将 DBMON 的对象导入到 DH
. . 正在导入表 "DH_SQL"
illegal lob length marker 49920
bytesread = 00000000000
TABLE = DH_SQL
IMP-00098: INTERNAL ERROR: impgst2
IMP-00008: 导出文件中出现无法识别的语句:
IMP-00008: 导出文件中出现无法识别的语句:
IMP-00008: 导出文件中出现无法识别的语句:
IMP-00008: 导出文件中出现无法识别的语句:
IMP-00008: 导出文件中出现无法识别的语句:
...省略后续部分.......
(3)使用工具抽取dmp文件中的表结构,如下
DUL> scan dump file e:\test\test.dmp;
0: CSET: 852 (ZHS16GBK)
3: SEAL EXPORT:V11.02.00
20: USER DBMON
28: TYPE TABLES
2317: TABLE "DH_SQL"
2332: CREATE TABLE "DH_SQL" ("ID" NUMBER, "NAME" VARCHAR2(128), "TYPE" VARCHAR2(19)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 41
94304 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS
2597: INSERT INTO "DH_SQL" ("ID", "NAME", "TYPE") VALUES (:1, :2, :3)
2661: BIND information for 3 columns
col[ 1] type 2 max length 22
col[ 2] type 1 max length 128 cset 852 (ZHS16GBK) form 1
col[ 3] type 1 max length 19 cset 852 (ZHS16GBK) form 1
Conventional export
2687: start of table data
2781632: TABLE "DH_STAT"
2781648: CREATE TABLE "DH_STAT" ("ID" NUMBER, "NAME" VARCHAR2(128), "TYPE" VARCHAR2(19)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIA
L 4194304 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS
2781914: INSERT INTO "DH_STAT" ("ID", "NAME", "TYPE") VALUES (:1, :2, :3)
2781979: BIND information for 3 columns
col[ 1] type 2 max length 22
col[ 2] type 1 max length 128 cset 852 (ZHS16GBK) form 1
col[ 3] type 1 max length 19 cset 852 (ZHS16GBK) form 1
Conventional export
2782005: start of table data
5898003: CREATE INDEX "IND111" ON "DH_STAT" ("NAME" ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 3145728 NEXT 1048576 MINEXTENTS 1 FREELISTS
1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING
5898339: CREATE INDEX "IND_2" ON "DH_STAT" ("NAME" , "ID" ) PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 4194304 NEXT 1048576 MINEXTENTS 1 FREE
LISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING
5900617: TABLE "DH_STAT"
5900705: ENDTABLE
5900740: EXIT
5900745: EXIT
(4)抽取dmp文件中的表数据,如下
1.抽取"DBMON"."DH_SQL"表数据
DUL> unexp table "DBMON"."DH_SQL" ("ID" NUMBER, "NAME" VARCHAR2(128), "TYPE" VARCHAR2(19)) dump file e:\test\test.dmp from 0;
DUL: Error: column 1 length 771 exceeds max bind size 22
0000000000 54455850 4f52543a 5631312e 30322e30 TEXP ORT: V11. 02.0
0000000016 300a5544 424d4f4e 0a525441 424c4553 0.UD BMON .RTA BLES
0000000032 0a323034 380a300a .204 8.0.
0: column 1 type NUMBER size 771 failed
0: row 1 failed
row conversion failure, retrying from offset 1
2687: succesful conversion 2687 bytes skipped due to conversion problems
DUL: Error: Bad digit in number 222 (0xdf)
0000000000 c3df03d2 ....
2897: column 1 type NUMBER size 4 failed
2897: row 7 failed
row conversion failure, retrying from offset 2862
2925: row 7 partial success
2960: succesful conversion 63 bytes skipped due to conversion problems
DUL: Error: column 1 length 3844 exceeds max bind size 22
0000000000 ddf20406 13d05359 535f594f 49443030 .... ..SY S_YO ID00
0000000016 d0303f31 30333034 24040054 59504500 .0?1 0304 $..T YPE.
0000000032 000400c3 0204050c .... ....
3109: column 1 type NUMBER size 3844 failed
DUL: Error: column 1 length 21835 exceeds max bind size 22
0000000000 245f524d 47525f50 4c414e5f 54040054 $_RM GR_P LAN_ T..T
0000000016 59504500 000400c3 02050f13 00535953 YPE. .... .... .SYS
0000000032 5f594f49 44303030 _YOI D000
3109: column 1 type NUMBER size 21835 failed
3109: row 12 failed
row conversion failure, retrying from offset 3085
3144: succesful conversion 35 bytes skipped due to conversion problems
DUL: Error: column 1 length 223 exceeds max bind size 22
0000000000 c302040a 13005359 535f594f 49443030 .... ..SY S_YO ID00
0000000016 3030f031 30333038 24040054 f9d04500 00.1 0308 $..T ..E.
0000000032 df04d0c3 0204f9df .... ....
3235: column 1 type NUMBER size 223 failed
3235: row 15 failed
row conversion failure, retrying from offset 3202
3236: row 15 partial success
3337: row 15 partial success
3454: succesful conversion 219 bytes skipped due to conversion problems
Unloaded 62604 rows, end of table marker at 2781631
2.抽取"DBMON"."DH_STAT"表数据
DUL> unexp table "DBMON"."DH_STAT" ("ID" NUMBER, "NAME" VARCHAR2(128), "TYPE" VARCHAR2(19)) dump file e:\test\test.dmp from 2781632;
DUL: Error: column 1 length 16724 exceeds max bind size 22
0000000000 424c4520 2244485f 53544154 220a4352 BLE "DH_ STAT ".CR
0000000016 45415445 20544142 4c452022 44485f53 EATE TAB LE " DH_S
0000000032 54415422 20282249 TAT" ("I
2781632: column 1 type NUMBER size 16724 failed
2781632: row 1 failed
row conversion failure, retrying from offset 2781633
2782005: succesful conversion 373 bytes skipped due to conversion problems
Unloaded 72612 rows, end of table marker at 5898002
DUL: Warning: Recreating file "DBMON_DH_STAT.ctl"
(5)将数据通过sqlldr入库,如下
1.先删除表中数据
SQL> conn dbmon/dbmon
已连接。
SQL> delete dh_sql;
已删除62613行。
SQL> commit;
2.sqlldr进行导入
E:\test>sqlldr dbmon/dbmon control=e:\test\DBMON_DH_SQL.ctl
SQL*Loader: Release 11.2.0.1.0 - Production on 星期二 5月 1 11:16:43 2007
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
达到提交点 - 逻辑记录计数 64
达到提交点 - 逻辑记录计数 128
达到提交点 - 逻辑记录计数 192
达到提交点 - 逻辑记录计数 256
达到提交点 - 逻辑记录计数 320
达到提交点 - 逻辑记录计数 384
达到提交点 - 逻辑记录计数 448
达到提交点 - 逻辑记录计数 512
达到提交点 - 逻辑记录计数 576
达到提交点 - 逻辑记录计数 640
达到提交点 - 逻辑记录计数 704
达到提交点 - 逻辑记录计数 768
达到提交点 - 逻辑记录计数 832
达到提交点 - 逻辑记录计数 896
达到提交点 - 逻辑记录计数 960
达到提交点 - 逻辑记录计数 1024
...省略一部分.......
达到提交点 - 逻辑记录计数 62426
达到提交点 - 逻辑记录计数 62490
达到提交点 - 逻辑记录计数 62554
达到提交点 - 逻辑记录计数 62606
3.确认数据已经导入
SQL> select count(*) from dh_sql;
COUNT(*)
----------
62605 --小于导出时的记录数
可以看到,部分数据由于损坏,已经丢失
(6)处理其它表,根据(1)-(5)步骤。