backup/dump oracle database

Note:

  1. Syntax below will have to be setup as a shell script (filename.sh file)
  2. The DIRECTORY=dmpdir is setup using the sqlplus (google it)

 

find /U03/backup/*.gz -mtime +1 -exec rm {} \;
find /U03/backup/*.dmp -mtime +1 -exec rm {} \;
find /U03/backup/*.log -mtime +1 -exec rm {} \;

ORACLE_BASE=/U01/oracle
export ORACLE_BASE
ORACLE_HOME=/U01/oracle/product/11.1.0/db_1
export ORACLE_HOME
ORACLE_SID=ffx11g
export ORACLE_SID

expdp \’user/password as sysdba\’ FULL=y DIRECTORY=dmpdir DUMPFILE=file_name.dmp LOGFILE=export.log

# Date and other variables pretty self explanatory, S is seconds
# date format is currently YYYYMMDD_HHMMSS
        dater=$(date)
        dayer=$(date +%a%F%H%m)
        namer=$(whoami)
        hoster=$(hostname)
        directory=$(pwd)
        filenamer=$(date)_Cimmaron
# sets day of the week
        set $(date)
        logger=/tmp/ftplog.txt
        emailer=/U03/backup/export.log

# subject and recipient variables. sends the email
sendto=”emailaddress@domain“;

cat $emailer | mail -s “$filenamer” $sendto

gzip /U03/backup/*.*

Advertisements