I’ll write up a sister script to be used for import
#!/bin/bash
#===================================================================================
#
# FILE: expdp_helper.sh
#
# USAGE: Run from command line
#
# DESCRIPTION: DataPump Export of database
# OPTIONS:
# REQUIREMENTS:
# AUTHOR: Matt D
# CREATED: August 5, 2011
# UPDATED: June 21, 2012
# VERSION: 1.5
#
#
#
#
#
#
#===================================================================================
clear screen
# Get the directory path to store the dump files
echo ---------------------------------------
echo "Please enter the path for the dump files > "
read EXPDIR
# Check for directory & create if not there
if [ ! -d ${EXPDIR} ] ;
then
echo "Looks like ${EXPDIR} doesn't exist..."
echo "I'll try and make it for you."
mkdir -p ${EXPDIR}
fi
# Get the source database name
echo ---------------------------------------
echo "Please enter the TNS Name for the source database > "
read DBNAME
# Get the system password
echo ---------------------------------------
echo "Please enter the password for the database system user > "
read SYSPASS
# Create the directory on the OS and directory object in the database
# Create a file to recreate the tablespaces
mkdir -p $EXPDIR
export ORACLE_SID=${DBNAME}
sqlplus -s system/${SYSPASS}<<EOF
drop directory dbexport;
create directory dbexport as '${EXPDIR}';
grant read,write on directory dbexport to public;
spool ${EXPDIR}/create_tablespaces.sql
select 'create bigfile tablespace '||tablespace_name|| ';' from dba_tablespaces where tablespace_name not in ('SYSTEM','SYSAUX','APEX') AND tablespace_name NOT LIKE 'UNDO%';
spool off;
exit;
EOF
# Create a shell script to perform the export
echo "export ORACLE_SID=${DBNAME}" >FULLEXPORT.sh
echo "expdp system/${SYSPASS} DIRECTORY=dbexport FULL=Y JOB_NAME=FULL_EXPORT FILESIZE=250M DUMPFILE=FULL_EXPORT_%U.dmp COMPRESSION=ALL LOGFILE=fullexport.log PARALLEL=32" >>FULLEXPORT.sh
chmod 755 FULLEXPORT.sh
chmod 755 FULLEXPORT.sh
# Tell user to run the DataPump Export
echo "Please run FULLEXPORT.sh to export the database"
Leave a comment