NuxOra – Linux and Oracle IT website

Admistration, configuration, déploiement, optimisation et tuning.

Export script – beginners

Here is a very simple script to save an Oracle database with a full export script.
It’s a very basic example, because there is no log and no option (only a full export)
Ina few days i’ll post a more detailled export script.

#!/bin/bash
#—————————#
# Oracle Full export script #
# Nuxora v1.0 #
#—————————#

# set env
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export ORACLE_SID=$1
when=`date +”%d%m”`

# export
exp expimp/$2 file=”$ORACLE_BACKUP”/admin/exp/full/$ORACLE_SID/exp”$when”_”$ORACLE_SID”_”FULL”.dmp FULL=Y ROWS=Y

# keep only 7 days
for file in `find “$ORACLE_BACKUP/admin/exp/full/$ORACLE_SID” -name “exp*.dmp” -mtime +7 -print`
do
echo $file
rm $file
done

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>