Take oracle users as an Example
1. log on to the system with an oracle user
2. Create the Backup Directory mkdir backup
3. write the script/Oracle/backup. sh:
Export $ ORACLE_HOME =/Oracle/APP/product/9.2.0;
Export $ oracle_sid = orcl;
Export $ Path = $ ORACLE_HOME/bin: $ path;
Exp test/test file =/Oracle/backup/$ (date + "% Y % m % d "). DMP tables = user log =/Oracle/backup/$ (date + "% Y % m % d "). log
3. Use LS-L to check whether backup. Sh has executable permissions. If you do not use chmod U + x backup. Sh, grant the backup. Sh executable permission.
4. Execute backup. Sh. If DMP is exported successfully, perform Step 1. Otherwise, check the backup. Sh script.
5. Check whether oracle users can use the crontab command:
Check the cron. deny and cron. allow files in the/var/adm/cron directory. Each row in these two files is a user name.
Without these two files, only the root user can use crontab.
If you only use cron. deny, make sure that the file does not contain oracle.
If there is only cron. allow, check that the file contains Oracle Only .
If cron. deny and cron. allow exist, cron. deny does not contain Oracle, and cron. allow contains oracle. .
For more details, use man crontab to view the description.
6. Enter the command crontab-e to open a text editor.
7. Enter 55 23 1 ** \ oracle \ backup. Sh to execute a backup script at on the first day of each month.
Note:
because crontab-E is used to edit a job, therefore, you do not need to restart the cron process or the machine.