Tables export and import from one schema to another with sequence in Oracle Database

Tables export and import from one schema to another with sequence in Oracle Database


Schema 1 tables moves into Schema 2


Multiple table export from schema 1

expdp \"/ as sysdba \" tables=schema1.table1,schema1.table2 directory=D1 dumpfile=dumpfile_%U.dmp compression=ALL consistent=Y logfile=logfile.log parallel=8

Multiple table import to schema 1


impdp \"/ as sysdba \" tables=schema1.table1,schema1.table2 remap_schema=schema1:schema2 REMAP_TABLESPACE=schema1_tablespace1:schema2_tablespace2 directory=D1 dumpfile=dumpfile_%U.dmp logfile=logfile.log TABLE_EXISTS_ACTION=REPLACE


Schema 1 sequence moves into Schema 2

Export sequence from schema 1

expdp \"/ as sysdba \" schemas=actionplan directory=D1 dumpfile=dumpfile_%U.dmp INCLUDE=sequence compression=ALL consistent=Y logfile=logfile.log parallel=8
 

Import sequence into schema 2

impdp \"/ as sysdba \" directory=D1 dumpfile=dumpfile_%U.dmp INCLUDE=sequence remap_schema=schema1:schema2 REMAP_TABLESPACE=schema1_tablespace1:schema2_tablespace2 logfile=logfile.log parallel=8


Validate Sequence

SELECT sequence_name
FROM dba_sequences
WHERE sequence_owner = 'schema1'
MINUS
SELECT sequence_name
FROM dba_sequences
WHERE sequence_owner = 'schema2';
 

Comments