EXPDP/IMPDP example in oracle for database copy
Normally we need to have a database copy to export/import on our other database and separate schema. Here are the steps to do the schema copy from one database to another. You need to be admin user for performing some tasks.
$ mkdir datapump
$ chmod 777 datapump/
$ sqlplus adminuser1/adminpassword1@dbsid1
SQL> create directory datapump as '/path/to/folder/datapump';
SQL> grant read, write on directory datapump to public;
$ expdp user1/password1@dbsid1 dumpfile=datapump:myschema.dmp logfile=datapump:myschema_exp.log schemas=myschema
$ sqlplus adminuser2/adminpassword2@dbsid2
SQL> create directory datapump as '/same/path/to/folder/datapump';
SQL> grant read, write on directory datapump to public;
$ impdp user2/password2@dbsid2 dumpfile=datapump:myschema.dmp logfile=datapump:myschema_imp.log remap_schema=myschema:yourschema remap_tablespace=mytablespace:yourtablespace
You can remove remap_schema and remap_tablespace clauses in case your schema name and tablespace name are same on both the databases.
You also need to have same datapump location accessible from both the databases.
0 comments:
Post a Comment