Skip to main content

Export and import multiple schema using expdp/impdp (Data Pump utility)

Use the below sql query to export and import multiple schema:

expdp schemas=schema1,schema2,schema3 directory=DATA_PUMP_DIR dumpfile=schemas120514bkp.dmp exclude=statistics logfile=expdpschemas120514.log

impdp schemas=schema1,schema2,schema3 directory=DATA_PUMP_DIR dumpfile=schemas120514bkp.dmp logfile=impdpschemas120514.log

sql query to export and import a schema:

expdp schemas=schema directory=DATA_PUMP_DIR dumpfile=schema120514bkp.dmp exclude=statistics logfile=expdpschema120514.log

impdp schemas=schema directory=DATA_PUMP_DIR dumpfile=schema120514bkp.dmp logfile=expdpschema120514.log

Parameter STATISTICS=NONE can either be used in export or import. No need to use the parameter in both.

To export meta data only to get ddl of the schemas:

expdp schemas=schema1,schema2,schema3 directory=TEST_DIR dumpfile=content.dat content=METADATA_ONLY exclude=statistics

To get the DDL in a text file:

impdp directory=TEST_DIR sqlfile=sql.dat logfile=sql.log dumpfile=content120514.dat

You can open the sql.dat file in a text format to see the entire DDL of the schema exported.

To check the DATA_PUMP_DIR path:

To see the DATA_PUMP_DIR location on server, use below sql query

set lines 300
col DIRECTORY_PATH for a50
select * from dba_directories where directory_name='DATA_PUMP_DIR';

To change the directory path:

connect database as sysdba and give following query

CREATE OR REPLACE DIRECTORY test_dir AS '/backup_DB/';

For example:

expdp schemas=schema directory=TEST_DIR dumpfile=schema120514bkp.dmp exclude=statistics logfile=expdpschema120514.log

impdp schemas=schema directory=TEST_DIR dumpfile=schema120514bkp.dmp logfile=expdpschema120514.log

Comments

  1. First, Thanks a lot.
    Nice Article. Was really helpful. Keep it up.

    ReplyDelete
  2. Hi my friend.

    I need to export schemmas in Oracle, using the expdp.

    My question:

    I can use the select,exemple.

    select owner, version , database
    from versionsdb
    where database='Model' ** in here model is a schemma model, without data, just estruture tables )

    Answer the select

    owner
    db01 | 12.1.1.0 | model
    db01 | 12.1.2.0 | model



    What I need. I need to generate the backup without me worrying that every time I have another version, I have to go in the script and add a line that informs the new model schema.

    ReplyDelete

Post a Comment

Popular posts from this blog

SQL queries which is using more CPU resources

Here we'll see how to find heavy or more cpu consumed sql query in oracle We are facing high CPU load on Linux servers daily at times. Whenever CPU load is high, we'll get the TOP output and if the load is due to oracle database, we'll track currently running sql queries which is using more CPU on database & update the customer when they ask RCA report of high CPU load on servers. The below query is to find the sql queries which is causing CPU load on server & using more CPU resources currently. sessions based on cpu usage : ----------------------------------------- set pages 1000 set lines 1000 col OSPID for a06 col SID for 99999 col SERIAL# for 999999 col SQL_ID for a14 col USERNAME for a15 col PROGRAM for a23 col MODULE for a18 col OSUSER for a10 col MACHINE for a25 select * from ( select p.spid "ospid", (se.SID),ss.serial#,ss.SQL_ID,ss.username,substr(ss.program,1,22) "program",ss.module,ss.osuser,ss.MACHINE,ss.status, ...

Cloud Control EM13c - Loader Throughput (rows per second) for Loader_D crossed the critical threshold and Total Loader Runtime in the Last Hour (seconds) for Loader_D crossed the critical threshold

Hello Guys, Here is an another post related to Cloud Control EM13c - Real-time Scenario. Suddenly We were receiving the following warning and critical alerts from EM13c Cloud Control during the time slot between 12 AM and 04:00 AM daily. 1)  Message= Loader Throughput (rows per second) for Loader_D crossed the critical threshold (xx). Current value: xx.xx 2)  Message= Total Loader Runtime in the Last Hour (seconds) for Loader_D crossed the critical threshold (x,xxx). Current value: xxxx.xx 3)  ORA-error stack (3,136) and ORA-error stack (609) were also logged in alert log 4)  Message= Incident (BEA-310003 [LowMemory]) detected in $OMS_HOME/gc_inst/user_projects/domains/GCDomain/servers/EMGC_OMS1/adr/diag/ofm/GCDomain/EMGC_OMS1/alert/log.xml at time/line number: When we analyzed the AWR reports of EM PDB repository database, we found there were few PL/SQL statements given below causing this issue with wait event  SQL*Net Break/reset To Client...