简体   繁体   English

DBMS_DATAPUMP API 从不同模式导出/导入表

[英]DBMS_DATAPUMP API export/import tables from different schemas

I would like to export import tables from multiple schemas with DBMS_DATAPUMP API.我想使用 DBMS_DATAPUMP API 从多个模式中导出导入表。 EG user1.table1 user2.table2 user3.table3 I give in a parameter the tables like a list with comma separated. EG user1.table1 user2.table2 user3.table3 我在一个参数中给出了表格,就像一个用逗号分隔的列表。 'user1.table1,user2.table2,user3.table3' After that I store in a table the list of tables. 'user1.table1,user2.table2,user3.table3' 之后我将表列表存储在一个表中。 Then I read in a cursor the content of the table and go through in the cursor with a LOOP and give the schemas and table names one by one.然后我在 cursor 中用 LOOP 读取了 cursor 表的内容和 go 的内容,并一一给出了模式和表名。

LOOP
 dbms_datapump.metadata_filter(handle => h1, name => 'NAME_EXPR', value => 'IN('table1'));
 dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_LIST', value => 'IN('user1'));
END LOOP.

The first table is successfully added to the dbms_datapump job, but the second table exit with error.第一个表已成功添加到 dbms_datapump 作业,但第二个表退出并出现错误。

ORA-39071: Value of SCHEMA_LIST is badly formed. ORA-39071: SCHEMA_LIST 的值格式错误。 ORA-00936: missing exprension ORA-00936: 缺少表达式

I tired to find solutions how to exp/imp with DBMS_DATAPUMP API tables from different schemas but I have found any examples.我厌倦了寻找如何使用来自不同模式的 DBMS_DATAPUMP API 表进行 exp/imp 的解决方案,但我找到了任何示例。 The examples whih I found only shows if you are exp/imp from one schema.我发现的示例仅显示您是否来自一个模式的 exp/imp。 Thanks in advance提前致谢

--For Table mode, only a single SCHEMA_EXPR filter is supported. --对于表格模式,仅支持单个 SCHEMA_EXPR 过滤器。 If specified, it must only specify a single schema (for example, 'IN (''SCOTT'')').如果指定,它只能指定一个模式(例如,'IN (''SCOTT'')')。

DBMS_DATAPUMP.METADATA_FILTER(handle, 'SCHEMA_EXPR', 'IN('||vschemas||')'); DBMS_DATAPUMP.METADATA_FILTER(handle, 'SCHEMA_EXPR', 'IN('||vschemas||')');

--you can enter more than one table name, but no more than 4000 characters (literal limit), including special characters. -- 可以输入多个表名,但不超过 4000 个字符(字面限制),包括特殊字符。

DBMS_DATAPUMP.METADATA_FILTER(handle, 'NAME_EXPR', 'IN('||vtables||')', 'TABLE'); DBMS_DATAPUMP.METADATA_FILTER(handle, 'NAME_EXPR', 'IN('||vtables||')', 'TABLE');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM