Export the Schemas

 Export:

-----------

When You perform Full export of database or Schema, you may need excluding some schemas or tables.

Especially your database or Schemas are too big, probably you need to exclude some schemas or tables during full export of database or Schema export.


You can add the EXCLUDE option to expdp command,

EXCLUDE syntax:


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

expdp ... SCHEMAS=scott EXCLUDE=SEQUENCE, TABLE:\"IN ('EMP', 'DEPT')\"


Exclude Table in Oracle

For Example;


Scenario 1:

I want to export MSDB Schema , If I need full schema export , following command can perform this.


expdp \"/ as sysdba\" directory=DATA_PUMP_DIR dumpfile=SchemaBackup%U.dmp schemas=MSDB logfile=SchemaBackup.log parallel=64 cluster=n


Scenario 2:

But,I want to Exclude Some tables from MSDB Schema, All tables except this excluded tables will be exported by using EXCLUDE option as follows.


If you don’t use parfile ( parameter file ),you can get the quote marks errors or other special characters,So you need to be escaped with backslash (\) character in the exclude clause as follows.

OR You need to use parfile ( parameter file )


expdp \"/ as sysdba\" directory=DATA_PUMP_DIR dumpfile=SchemaBackup%U.dmp schemas=MSDB logfile=SchemaBackup.log parallel=64 cluster=n EXCLUDE=TABLE:\= \'TABLE_1\'\ EXCLUDE=TABLE:\= \'TABLE_2\'\ EXCLUDE=TABLE:\= \'TABLE_3\'\


expdp \"/ as sysdba\" directory=DATA_PUMP_DIR dumpfile=SchemaBackup%U.dmp schemas=MSDB logfile=SchemaBackup.log parallel=64 cluster=n EXCLUDE=TABLE:\"IN ('TABLE_1', 'TABLE_2','TABLE_3')\"


Scenario 3:

Exclude Schema in Oracle:


If I need full database export , following command can perform this.


expdp \"/ as sysdba\" directory=DATA_PUMP_DIR dumpfile=FullDatabase%U.dmp full=y logfile=FullDatabase.log parallel=64 cluster=n


Scenario 4:

But, I want to Exclude Some schemas from Full database export, All Schemas except this excluded schemas will be exported by using EXCLUDE option as follows.


expdp \"/ as sysdba\" directory=DATA_PUMP_DIR dumpfile=FullDatabase%U.dmp full=y logfile=FullDatabase.log parallel=64 cluster=n exclude=schema: "IN ('SCHEMA_1', 'SCHEMA_2','SCHEMA_3')"



If you don’t use parfile ( parameter file ),you can get the quote marks errors or other special characters, So you need to be escaped with backslash (\) character in the exclude clause as follows. OR You need to use parfile ( parameter file )


expdp \"/ as sysdba\" directory=DATA_PUMP_DIR dumpfile=FullDatabase%U.dmp full=y logfile=FullDatabase.log parallel=64 cluster=n EXCLUDE=SCHEMA:\"IN \(\'ORDSYS\',\'ORDPLUGINS\'\, \'SI_INFORMTN_SCHEMA\'\, \'ORDDATA\'\, \'MDSYS\'\)\"


Comments

Popular posts from this blog

Troubleshooting EBS login page issue in R12.2:

Oracle apps dba Interview Q&A's

Goldengate basics and Bounce