同一个用户的两个不同内容的dmp文件如何导入?

[复制链接]
查看11 | 回复5 | 2006-2-14 08:33:40 | 显示全部楼层 |阅读模式
我现在有同一个用户us1的两个dmp文件,其中a.dmp是其2005年以前的数据,b.dmp是2006年的数据,a.dmp已经导入到us1下,怎么把b.dmp的内容追加到us1中去呢?
回复

使用道具 举报

千问 | 2006-2-14 08:33:40 | 显示全部楼层
最初由 myhkming 发布
[B]我现在有同一个用户us1的两个dmp文件,其中a.dmp是其2005年以前的数据,b.dmp是2006年的数据,a.dmp已经导入到us1下,怎么把b.dmp的内容追加到us1中去呢? [/B]

顺次导入就可以了,数据是不会冲突的。
看我如下的测试:
======================================================
1、建立测试表并插入数据
SQL> select * from ee;
SDFSDFSDF
----------
aaaaa
bbbbb
2、以两个批次导出数据
oracle@yang:~> cd yang1
oracle@yang:~/yang1> ls
oracle@yang:~/yang1> exp hr/hr file=a.dmp tables=ee query=\"where SDFSDFSDF=\'aaaaa\'\"
Export: Release 9.2.0.4.0 - Production on Fri Mar 17 11:05:15 2006
Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export done in UTF8 character set and UTF8 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table
EE
1 rows exported
Export terminated successfully without warnings.
oracle@yang:~/yang1> exp hr/hr file=b.dmp tables=ee query=\"where SDFSDFSDF=\'bbbbb\'\"
Export: Release 9.2.0.4.0 - Production on Fri Mar 17 11:05:49 2006
Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export done in UTF8 character set and UTF8 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table
EE
1 rows exported
Export terminated successfully without warnings.
oracle@yang:~/yang1> ls -l *dmp
-rw-r--r--1 oracle dba 16384 2006-03-17 11:05 a.dmp
-rw-r--r--1 oracle dba 16384 2006-03-17 11:05 b.dmp
3、清除测试表中的数据
SQL> truncate table ee;
Table truncated.
SQL> select * from ee;
no rows selected
4、导入
oracle@yang:~/yang1> imp hr/hr file=a.dmp tables=ee ignore=y
Import: Release 9.2.0.4.0 - Production on Fri Mar 17 11:06:46 2006
Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
import done in UTF8 character set and UTF8 NCHAR character set
. importing HR's objects into HR
. . importing table
"EE"
1 rows imported
Import terminated successfully without warnings.
oracle@yang:~/yang1> imp hr/hr file=b.dmp tables=ee ignore=y
Import: Release 9.2.0.4.0 - Production on Fri Mar 17 11:07:29 2006
Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
import done in UTF8 character set and UTF8 NCHAR character set
. importing HR's objects into HR
. . importing table
"EE"
1 rows imported
Import terminated successfully without warnings.
5、查询一下,确认已成功。
SQL> select * from ee
2/
SDFSDFSDF
----------
aaaaa
bbbbb
可以看到导入成功!
回复

使用道具 举报

千问 | 2006-2-14 08:33:40 | 显示全部楼层
hrb_qiuyb回答的真认真,佩服


回复

使用道具 举报

千问 | 2006-2-14 08:33:40 | 显示全部楼层
最初由 myhkming 发布
[B]我现在有同一个用户us1的两个dmp文件,其中a.dmp是其2005年以前的数据,b.dmp是2006年的数据,a.dmp已经导入到us1下,怎么把b.dmp的内容追加到us1中去呢? [/B]

关键就是用 ignore=y 参数,会忽略创建表错误,继续导入里面的数据。
回复

使用道具 举报

千问 | 2006-2-14 08:33:40 | 显示全部楼层
除非可以保证在拥有唯一性的列/列的组合 不会发生冲突。
回复

使用道具 举报

千问 | 2006-2-14 08:33:40 | 显示全部楼层
谢谢各位。明白了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行