Ask the Expert

Performing nightly exports in cron

Is there any place I can retrieve a cron job for a nightly export? I would like implement nightly exports on our production databases in addition to our current backup procedures.

    Requires Free Membership to View

Here is a script that I've used to perform nightly exports in cron. You'll have to make adjustments for your specific environment.

#! /bin/csh
# export_SID_full.sh
#
# This script is run every nightly to export the database.
setenv ORAENV_ASK NO
unsetenv SQLPATH
set SCRIPT_HOME=/directory/scripts
set EXP_HOME=/directory/export
set LOG_HOME=/directory/scripts/logs
set PIPE_HOME=/directory/tmp

#for each SID, do
foreach SID ( ORCL )
setenv ORACLE_SID $SID
source /usr/local/bin/coraenv
compress < $PIPE_HOME/exp_pipe > $EXP_HOME/exp_full.dmp.Z &
exp file=$PIPE_HOME/exp_pipe full=y log=$LOG_HOME/exp_full.log
userid=system < $SCRIPT_HOME/security/passwd > /dev/null
mv $LOG_HOME/exp_full.log $LOG_HOME/exp_`date '+%h%d'`
end

Feel free to use and modify the above script for your purposes.

This was first published in December 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: