Import Tables without Constraints from Schema Export

datapumpimpdporacleoracle-11g-r2

I am trying to do an import using data pump, but I am struggling to come up with the right options. The export was taken as a schema export. I am trying to import just the tables, with no other database objects.

I am currently using

INCLUDE=TABLE
TABLE_EXISTS_ACTION=REPLACE
REMAP_SCHEMA=
REMAP_TABLESPACE=

This is correctly importing the tables, but I am a little surprised to see that the import is also creating the constraints and triggers on the tables, or trying to at least. The triggers are failing because they include a schema name that does not exist in the database.

I thought that by using INCLUDE=TABLE only the tables would be included. Apparently that is not the case. I am unable to use EXCLUDE=CONSTRAINT or EXCLUDE=TRIGGER as I am already using INCLUDE to limit the import to just tables.

Any ideas on how I could structure the import to only import tables?

Best Answer

You are right when stating I thought that by using INCLUDE=TABLE only the tables would be included, but it includes all related objects too. This means that constraints and triggers will be created for you when you use INCLUDE=TABLE when importing.


Possible Solution

If you have the possibility to re-create the dump using the expdp command then you might want to just export the tables of the required schema and use the INCLUDE parameter.

INCLUDE

Purpose: Enables you to filter the metadata that is exported by specifying objects and object types for the current export mode. The specified objects and all their dependent objects are exported. Grants on these objects are also exported.

exp_include.par

This is basically the expdp parameter file.

FULL=N
...
SCHEMAS=<your_schema(s)>
INCLUDE=TABLE
...

This will create a dump of the required schema and contain only tables and dependant objects.


After you have generated the required *.dmp file, import using the EXCLUDE=... option.

EXCLUDE

Purpose: Enables you to filter the metadata that is imported by specifying objects and object types to exclude from the import job.

imp_exclude.par

This is the parameter file for the impdp.

FULL=Y
...
EXCLUDE=STATISTIC
EXCLUDE=CONSTRAINT
EXCLUDE=TRIGGER
...

This should result in the tables being imported correctly.

Reference Material