Tuesday, September 29, 2015

How to export and import Database Schema (exp,expdp &imp, impdp commands)



1.open the Unix box or command prompt window from your windows machine.
2.Navigate to the drive and directory as required.
3.Run the below command to  export the database.


   :    tnsping mtbys220  ( first ensure the database connection using this query)

Export data base schema:

command to be used to export is:

 1. (traditional export without datapump)
  exp system/manager@mtbys220  directory=EXP_DIR dumpfile=mth_mtbys220.dmp logfile=expdp_mth.log schemas=mth

 2. with data pump export

:    expdp system/manager@mtbys220  directory=EXP_DIR dumpfile=mth_mtbys220.dmp logfile=expdp_mth.log schemas=mth version=11.2.0.0.0



<system/manager> is username and password.
<mtbys220> is instance name  from where you want to export db schema

<mth >  is your schema name

<EXP_DIR >  is the folder/directory  name in which your db where you want to save the exported dmp file.
<mth_mtbys220.dmp >  is the file name you want to save it

<impdp_mth.log>  is teh log file name you want to save it

<version=11.2.0.0.0>  this parameter is mandatory when you need to import the .dmp file to an lower(previous) database versions than of its exported database version. i.e. it allows to create the dump file which is compatible with the previous releases. otherwise it will cause errors while importing.

  * if you are importing to same db version, this VERSION parameter is optional.

General issues faced:


import data base schema:

  command to be used to import is :

   1.  traditional command  without data pump

:  imp  system/manager@mtbys220 schemas=mth directory=EMP_DIR dumpfile=mth_mtbys220.dmp logfile=impdp_mth.log


 2.  with data pump

:  impdp system/manager@mtbys220 schemas=mth directory=EMP_DIR dumpfile=mth_mtbys220.dmp logfile=impdp_mth.log



<system/manager> is username and password.
<mtbys220> is instance name  to where you want to import the db schema

<mth >  is your target schema name.

<IMP_DIR >  is the folder/directory  name  where the .dmp file is available.
<mth_mtbys220.dmp >  is the  .dmp file  you want to import.

<impdp_mth.log>  is the log file name you want to create.
general issues faced:

No comments: