Requirement:

Configure a shell script, to take export backup of table daily at 3 PM  and send the log to stake holders.

Script: ( EXP_TAB_cmprss.sh)

# $Header: EXP_TAB_cmprss.sh  
# *====================================================================================+
# |  Author - DBACLASS ADMIN TEAM 
# |                                                       |
# +====================================================================================+
# |
# | FILENAME
# |     EXP_table_bkp_cmprss_dbaclass.sh
# |
# | DESCRIPTION
# |     Daily Export backup script of a list of table
# | PLATFORM
# |     Linux/Solaris

# +===========================================================================+
#!/bin/bash
echo Set Oracle Database Env
export ORACLE_SID=$1
export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin
export TIMESTAMP=`date +%a%d%b%Y`
export EXP_DIR=/export/home/oracle

echo =======
echo Export command
echo =======
echo $ORACLE_HOME
$ORACLE_HOME/bin/expdp \'/ as sysdba\' directory=DB_DUMPS dumpfile=expdp_tab_${TIMESTAMP}_%U.dmp logfile=expdp_log_${TIMESTAMP}.log tables=DBATEST.ORDER_TAB PARALLEL=6  COMPRESSION=ALL

echo SEND MAIL TO STAKE HOLDERS
echo =======
mailx -s "$ORACLE_SID $TIMESTAMP Export backup logfile" support@dbaclass.com < $EXP_DIR/expdp_log_${TIMESTAMP}.log
echo Export completed at $TIMESTAMP
exit

give 755 permission

chmod 755 EXP_TAB_cmprss.sh

Now configure the script in crontab as below( pass the ORACLE_SID )

00 15  * * * /export/home/oracle/EXP_TAB_cmprss.sh  TESTDB

 

NOTES: Please let us know if you are getting aany errors: