使用 impdp 导入选择性数据

发布于 2024-07-16 02:00:07 字数 243 浏览 8 评论 0原文

我有一个完整的数据库要作为转储导入到我自己的数据库中。 我想从某些表中排除数据(主要是因为它们的大小很大并且没有用)。 我不能完全排除这些表,因为我需要表对象本身(减去数据),并且如果这样做,则必须在我的架构中重新创建它们。 此外,在没有这些表对象的情况下,在其他表上定义的各种其他外部约束也将无法导入,并且需要重新定义。因此,我需要仅排除某些表中的数据。不过,我想要来自所有其他表的数据。

impdp 是否有一组参数可以帮助我做到这一点?

I have an entire DB to be imported as a dump into my own. I want to exclude data out of certain tables(mostly because they are huge in size and not useful). I cannot entirely exclude those tables since I need the table object per se(minus the data) and will have to re create them in my schema if I do so. Also in the absence of those table objects , various other foreign constraints defined on other tables will also fail to be imported and will need to be redefined.So I need to exclude just the data from certain tables.I want data from all other tables though.

Is there a set of parameters for impdp that can help me do so?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

够钟 2024-07-23 02:00:07

我将对其进行两次运行:第一次我将仅导入元数据:

impdp ... CONTENT=METADATA_ONLY

第二次将仅包含我感兴趣的表的数据:

impdp 。 .. CONTENT=DATA_ONLY 表=表1,表2...

I would make two runs at it: The first I would import metadata only:

impdp ... CONTENT=METADATA_ONLY

The second would include the data only for the tables I was interested in:

impdp ... CONTENT=DATA_ONLY TABLES=table1,table2...

柠栀 2024-07-23 02:00:07

绝对要跑​​2次。 一种方法是创建所有表对象,但不要在第二次 impdp 运行中使用表,而是使用排除。

impdp ... Content=data_only exclude=TABLE:"IN ('table1', 'table2')"

另一种方法可行,但这样您只需列出您不需要的表与所有您想要的表。

Definitely make 2 runs. One to create all the table objects, but instead of using tables in the second impdp run, use the exclude

impdp ... Content=data_only exclude=TABLE:"IN ('table1', 'table2')"

The other way works, but this way you only have to list the tables you don't want versus all that you want.

套路撩心 2024-07-23 02:00:07

如果表的大小对于导出导入来说很大,您可以在 expdp 命令中使用“SAMPLE”参数来按照您想要的百分比导出表......

$ expdp tables=T100test DIRECTORY=expimp1 DUMPFILE=test12.dmp SAMPLE = 10;

此命令将仅导出 T100test 表数据的 10% 数据。

If the size of the table is big for export import the you can use "SAMPLE" parameter in expdp command to take export of table for what ever percentage you want ....

$ expdp tables=T100test DIRECTORY=expimp1 DUMPFILE=test12.dmp SAMPLE = 10;

This command will export only 10% data of the T100test table's data.

捂风挽笑 2024-07-23 02:00:07

语法:

EXCLUDE=[object_type]:[name_clause],[object_type]:[name_clause]
INCLUDE=[object_type]:[name_clause],[object_type]:[name_clause]

运算符用法示例:

   EXCLUDE=SEQUENCE
or EXCLUDE=TABLE:"IN ('EMP','DEPT')"
or EXCLUDE=INDEX:"= 'MY_INDX'"
or INCLUDE=PROCEDURE:"LIKE 'MY_PROC_%'"
or INCLUDE=TABLE:"> 'E'"

参数也可以存储在参数文件中,例如:exp.par

DIRECTORY = my_dir
DUMPFILE = exp_tab.dmp
LOGFILE = exp_tab.log
SCHEMAS = scott
INCLUDE = TABLE:"IN ('EMP', 'DEPT')"

Syntax:

EXCLUDE=[object_type]:[name_clause],[object_type]:[name_clause]
INCLUDE=[object_type]:[name_clause],[object_type]:[name_clause]

Examples of operator-usage:

   EXCLUDE=SEQUENCE
or EXCLUDE=TABLE:"IN ('EMP','DEPT')"
or EXCLUDE=INDEX:"= 'MY_INDX'"
or INCLUDE=PROCEDURE:"LIKE 'MY_PROC_%'"
or INCLUDE=TABLE:"> 'E'"

The parameter can also be stored in a parameter file, for example: exp.par

DIRECTORY = my_dir
DUMPFILE = exp_tab.dmp
LOGFILE = exp_tab.log
SCHEMAS = scott
INCLUDE = TABLE:"IN ('EMP', 'DEPT')"
灰色世界里的红玫瑰 2024-07-23 02:00:07

看来您可以在使用 impdp 查询参数

impdp [...] QUERY='TABLE_NAME:"WHERE rownum = 0"'

cf 导入时直接排除: community.oracle.com

It seems you can exclude directly when importing using impdp query parameter

impdp [...] QUERY='TABLE_NAME:"WHERE rownum = 0"'

cf : community.oracle.com

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文