![]() |
|
Shell ScriptFull Database Export |
|
Full database export and compress using named pipes. Use the full database import script to import the data back.
$1 (MANDATORY) - ORACLE_SID of the database to export $2 (MANDATORY) - The directory of the compressed export file $3 (MANDATORY) - The database connect string to export from
REM Copyright (C) Think Forward.com 1998- 2005. All rights reserved.
#!/bin/ksh DATABASE=$1 DUMPDIR=$2 USERPASS=$3 # Check that we have a database to start if [ -z "${DATABASE}" ] then echo echo "No Database Specified !" echo echo "Usage : fulldbexport.ksh" echo echo "where ORACLE_SID (Mandatory) - SID of database to start" echo " DUMPDIR - Directory of the compressed export file" echo " CONNECT - Username/Password of the database user to export from." echo echo " e.g. $ fulldbexport.ksh PROD /dbexport system/manager" echo exit 1 fi # Check the dump directory exists if [ ! -d "${DUMPDIR}" ] then echo echo "$DUMPDIR does not exist !" echo exit 1 fi # Check we have an Oracle username and password if [ -z "${USERPASS}" ] then echo echo "No Database connect string specified !" echo echo "Usage : fulldbexport.ksh " echo echo "where ORACLE_SID (Mandatory) - SID of database to start" echo " DUMPDIR - Directory of the compressed export file" echo " CONNECT - Username/Password of the database user to export from." echo echo " e.g. $ fulldbexport.ksh PROD /dbexport system/manager" echo exit 1 fi # Get the ORACLE_HOME from the oratab file ORACLE_HOME=`cat /etc/oratab | grep $DATABASE | awk -F: '{print $2}'` if [ ! -d "${ORACLE_HOME}" ] then echo echo "$ORACLE_HOME does not exist !" echo exit 1 fi ORACLE_SID=$DATABASE export ORACLE_SID PATH=.:$ORACLE_HOME/bin:$PATH; export PATH LOGFILE=$DUMPDIR/exp${ORACLE_SID}_full.log PIPEFILE=$DUMPDIR/PIPE.dmp # Check we have created the named pipe file, or else there is no point # continuing if [ ! -p ${PIPEFILE} ] then echo echo "Create the named pipe file ${PIPEFILE} using " echo " $ mknod p $DUMPDIR/PIPE.dmp" echo exit 1 fi # Create a new empty logfile exec >$LOGFILE 2>&1 echo echo "*******************************************************" echo "* Exporting ${ORACLE_SID} database at `date`" echo "*******************************************************" echo exp $USERPASS full=y consistent=y buffer=1000000 file=${PIPEFILE} | compress < ${PIPEFILE} > $DUMPDIR/exp${ORACLE_SID}_full.dmp.Z echo echo "*******************************************************" echo "* Export Completed at `date`" echo "*******************************************************" echo exit 0
Oracle 9i: (Shell Script) Full Database Import
Return to Index of SQL Scripts
General Information :
Home | Company Profile
| Contact Us | Legal
Database Support :
Proactive Support
|
Pay Per Incident Support
Expert Services :
High Availability
|
Creative Solutions
|
Training
Build Services :
Oracle Installations
|
Revive your Oracle Setup
|
Low Cost Development
Free Oracle Resources:
DBA Scripts
|
Oracle Links