Oracle 数据泵(expdp和impdp)排除某个表

0    448    2

Tags:

👉 本文共约3566个字,系统预计阅读时间或需14分钟。

实验

环境:LHR和LHR1用户下都有T3表,如下:

如下,排除T3表,会排除LHR和LHR1这2个用户下的T3表:

如下写法并不能排除T3表:

解决:只导出元数据,不导出具体数据:

使用查询,也会排除所有用户下的T3表:

How to Exclude Multiple Schemas and Tables in Export or Import (Doc ID 2087052.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

NOTE: In the document content below, the user information and data used represents fictitious data. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

GOAL

Include or Exclude multiple tables from multiple schemas in full Export or Import.

SOLUTION

Following example will show to exclude or include multiple tables or schemas.
It can be used either on the command line or in a parameter file.

  1. Example to use include on the command line to include all tables for owner AJ or BJ:

  1. Example to use exclude in a par file to exclude table A1_TAB owned by user AJ and B1_TAB owned by user BJ.

Syntax:

Example:

There is another workaround mentioned in following document by using the QUERY parameter to make sure no rows for these tables are exported (only metadata is exported). Please refer to:
Note 1474932.1 - How to Exclude Duplicate Tables From Some Schemas During a Full DataPump Export

REFERENCES

BUG:6860716 - EXPORT&FILTER TABLES FROM MULTIPLE SCHEMAS IN DATA PUMP
NOTE:341733.1 - Export/Import DataPump Parameters INCLUDE and EXCLUDE - How to Load and Unload Specific Objects

How to Exclude Duplicate Tables From Some Schemas During a Full DataPump Export (Doc ID 1474932.1)

APPLIES TO:

Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

SYMPTOMS

You need to do a full database export but the same table is present in several schemas and you want to exclude this table for one schemas only.

CHANGES

NONE

CAUSE

Duplicate table names.

SOLUTION

Unfortunately, you cannot exclude the tables. From Note 277905.1:

\1. Note that all specified tables in the selected schemas are exported, together with their dependent objects.
It is not possible to include or exclude tables owned by a specific schema with a full database export DataPump job, or schema level export DataPump job with multiple schema's.

\2. As a workaround, you can use the query parameter to make sure no rows for these tables are exported (only metadata is exported):

REFERENCES

NOTE:277905.1 - Export/Import DataPump Parameter TABLES - How to Export and Import Tables Residing in Different Schemas

Export/Import DataPump Parameter TABLES - How to Export and Import Tables Residing in Different Schemas (Doc ID 277905.1)

APPLIES TO:

Oracle Database - Personal Edition - Version 10.1.0.2 to 11.1.0.7 [Release 10.1 to 11.1]
Oracle Database - Standard Edition - Version 10.1.0.2 to 11.1.0.7 [Release 10.1 to 11.1]
Oracle Database - Enterprise Edition - Version 10.1.0.2 to 11.1.0.7 [Release 10.1 to 11.1]
Information in this document applies to any platform.

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product.
Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

GOAL

With the classic export client you were able to export with one single export session, tables that were owned by different users.

本人提供Oracle(OCP、OCM)、MySQL(OCP)、PostgreSQL(PGCA、PGCE、PGCM)等数据库的培训和考证业务,私聊QQ646634621或微信dbaup66,谢谢!
AiDBA后续精彩内容已被站长无情隐藏,请输入验证码解锁本文!
验证码:
获取验证码: 请先关注本站微信公众号,然后回复“验证码”,获取验证码。在微信里搜索“AiDBA”或者“dbaup6”或者微信扫描右侧二维码都可以关注本站微信公众号。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复