Purpose: This tutorial shows basic steps to mount an nfs file system, create an Oracle directory, export data with expdp and reimport it into another database instance on another server using impdp.
This example expects high level access on both servers to create file systems, directories, mounts, and grant high level database privileges. There are other ways to perform all operations from a single instance without as much privilege but this doc does not cover them.
You’ll want to know several system settings or you will need to local them up. This items and examples are all listed below.
<local_nfs_mount> = /backup/oracledump
<nfs_mount_server> = nfsfileserver.snapdedo.com
<server_nfs_mount> = /backup/db/oracledump
<export_db_sid> = db11g_1
<import_db_sid> = db11g_2
<oracle_base> = /app/oracle
<oracle_dump_directory> = oracledump
<db_dir_name> = oracledump
<export_user> = jenkinss
<import_user> = jenkinss
<export_schemas> = schema1,schema2
<export_password> = abcd1234*
<import_password> = abcd1234*
<export_file> = exp_name_date.dmp
<export_log> = exp_name_date.log
<import_log> = imp_name_date.log
Export Server
mkdir <local_nfs_mount>
chmod 775 <local_nfs_mount>
mount -o hard,intr,noac,wsize=32768,rsize=32768 <nfs_mount_server>: <local_nfs_mount> <server_nfs_mount>
sudo su - oracle
. oraenv
<export_db_sid>
cd <oracle_base>
ln -s <local_nfs_mount> <oracle_dump_directory>
create directory <db_dir_name> as ''<oracle_base>/<oracle_dump_directory>";
grant unlimited tablespace to <export_user>;
grant dba to <export_user>;
grant sysdba to <export_user>;
expdp <export_user>/<export_password> schemas=<export_schemas> content=data_only directory=<db_dir_name> dumpfile=<export_file> logfile=<export_log>
Import Server
mkdir <local_nfs_mount>
chmod 775 <local_nfs_mount>
mount -o hard,intr,noac,wsize=32768,rsize=32768 <nfs_mount_server>: <local_nfs_mount> <server_nfs_mount>
sudo su - oracle
. oraenv
<import_db_sid>
cd <oracle_base>
ln -s <local_nfs_mount> <oracle_dump_directory>
create directory <db_dir_name> as ''<oracle_base>/<oracle_dump_directory>";
grant unlimited tablespace to <import_user>;
grant dba to <import_user>;
grant sysdba to <import_user>;
impdp <import_user>/<import_password> directory=<db_dir_name> dumpfile=<export_file> logfile=<import_log>
Example:
Export Server
mkdir /backup/oracledump
chmod 775 /backup/oracledump
mount -o hard,intr,noac,wsize=32768,rsize=32768 nfsfileserver.snapdedo.com:/backup/oracledump /backup/db/oracledump
sudo su - oracle
. oraenv
db11g_1
cd /app/oracle
ln -s /backup/oracledump oracledump
create directory oracledump as '/app/oracle/oracledump';
grant unlimited tablespace to jenkinss;
grant dba to jenkinss;
grant sysdba to jenkinss;
expdp jenkinss/abcd1234* schemas=schema1,schema2 content=data_only directory=oracledump dumpfile=exp_schema1_2_20130116.dmp logfile=exp_schema1_2_20130116.log
Import Server
mkdir /backup/oracledump
chmod 775 /backup/oracledump
mount -o hard,intr,noac,wsize=32768,rsize=32768 nfsfileserver.snapdedo.com:/backup/oracledump /backup/db/oracledump
sudo su - oracle
. oraenv
db11g_2
cd /app/oracle
ln -s /backup/oracledump oracledump
create directory oracledump as '/app/oracle/oracledump';
grant unlimited tablespace to jenkinss;
grant dba to jenkinss;
grant sysdba to jenkinss;
impdp jenkinss/abcd1234* directory=oracledump dumpfile=exp_schema1_2_20130116.dmp logfile=imp_schema1_2_20130116.log