EXPDP & IMPDP

step#1
-------
create a user to take this export and import backup in both source and destination database. after creating the user give them proper privileges

source database name:DB & backup taking user: pump_user
destination database name:ARCH & backup taking user: test_arch

grant DATAPUMP_IMP_FULL_DATABASE to pump_user;
grant DATAPUMP_EXP_FULL_DATABASE to pump_user;
grant EXP_FULL_DATABASE to pump_user;
grant IMP_FULL_DATABASE to pump_user;

grant DATAPUMP_IMP_FULL_DATABASE to test_arch;
grant DATAPUMP_EXP_FULL_DATABASE to test_arch;
grant EXP_FULL_DATABASEto test_arch;
grant IMP_FULL_DATABASEto test_arch;



step#2
-------
export and import between two databases required to create directory in both source and destination database.

SQL> CREATE DIRECTORY dmpdir AS '/opt/oracle';
Directory created.

SQL> GRANT read, write ON DIRECTORY dmpdir TO pump_user;
Grant succeeded.


step#3
-------
for network import you need to create a network link (nothing but a database link)
SQL> conn PUMP_USER@licdb
Enter password:
Connected.
SQL> drop database link db2arch;
SQL> create database link db2arch connect to test_arch IDENTIFIED by **** using 'ARCH';
SQL> select count (*) from user_tables@db2arch;

COUNT(*)
----------
33

impdp pump_user@db DIRECTORY=dmpdir NETWORK_LINK=db2arch tables=table_name



step#4
-------
Now we will create a dump in source database and import this dump into destination database
In this example we will take a schema backup

--run this after change the env export ORACLE_SID=DB that is source db
expdp pump_user DIRECTORY=dmpdir DUMPFILE=pump_user.dmp schemas=pump_user REUSE_DUMPFILES=Y

--run this after change the env export ORACLE_SID=ARCH that is destination db
impdp test_arch DIRECTORY=dmpdir DUMPFILE=pump_user.dmp remap_schema=pump_user:pump_user_arch


remap_schema will create a user pump_user_arch rather than pump_user


ref:
http://psoug.org/reference/datapump.html
http://www.orafaq.com/wiki/Datapump

Comments

Popular posts from this blog

Restoring Master, Model and MSDB from Netbackup

Oracle Job Operations