Posts

Showing posts with the label oracle expdp impdp shell

EXPDP automation in shell scripts

This script is created for SUN Solaris (no change requried) and RHEL (a small change will be required). it will do 1. create dump file of full db only metadata. 2. create dump of some particular tables. 3. tar and zip that file 4. ftp the files in some other safe places 5. finally delete old dump files from both servers. ORACLE_BASE=/oracle/orabase; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME ORACLE_SID=SHAONDB; export ORACLE_SID PATH=$ORACLE_HOME/bin:$PATH; export PATH CURR_MONTH=`date +"%b_%Y"|tr "[:lower:]" "[:upper:]"` CURR_DATE=`date +"%d_%b_%Y"|tr "[:lower:]" "[:upper:]"` ## 7days means 168 hour ### DAYAGO=`TZ=GMT+168 date +"%d_%b_%Y"|tr "[:lower:]" "[:upper:]"` ## in rhel it will be DAYAGO=`date -d '7 day ago' +"%d_%b_%Y"|tr "[:lower:]" "[:upper:]"` ## BASE_DIR="/backup/DUMP_ORACLE/DUMP_...

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...