Oracle database backup and recovery

Scheduling backup jobs in Linux

Scheduling backup jobs in Linux

By  Brian Peasland, Database Administrator, SGT, Inc.

How do I schedule my backup jobs in Linux? I scheduled a job using crontab, e.g., 30 13 * * * /backup_script/ Nothing happened, it didn't run. My database platform is Oracle 9i and my operating system is Red Hat.
The trickiest thing with scheduling shell scripts in cron is that the shell script does not run with your current environment settings. If you simply execute the shell script at your command line prompt, your script can use all of your session's current environment variables.

When that same script is executed via cron, you do not get your session's environment variables. So your shell script needs to have the environment variables it needs coded in the script.

To run the shell script just like cron would run it, use the "sh -x" command. For instance, to run your backup script like cron would, do the following:

sh -x /backup_script/
If there is an error in your script, you will find it when it is run in this manner. Fix any and all errors and then cron should have no problems running this script.

22 Sep 2005