1. Create a crontabsu for an Oracle user
1. Create a crontabsu-root crontab-u Oracle-l */5 *****/home/oracle/oracle_backup.sh for an oracle user (this task is executed every five minutes ).
1. Create a crontab for an Oracle user
Su-root
Crontab-u oracle-l
*/5 */home/oracle/oracle_backup.sh
(This shell file is executed every five minutes. This is a convenient test. You can modify the time for the test .)
2. Create a shell file
Cd/home/oracle/
Vi oracle_back.sh
The content is as follows:
#! /Bin/bash
Export ORACLE_BASE =/oracle
Export ORACLE_HOME =/oracle/product/10.2.0/db_1
Export ORACLE_SID = orcl
Export PATH = $ ORACLE_HOME/bin: $ PATH
Rq = 'date + % Y % m % d _ % H % m'
/Home/oracle/product/10.2.0/db_1/bin/exp scott/tiger owner = scott file =/home/oracle/backup/data _ $ rq. dmp log =/home/oracle/backup/log/log_backup _ $ rq. log
Note: (1) the export output must be written in the shell, because crontab cannot read the user's environment.
(2) Generally, do not use the root permission to execute regular commands. This is just a suggestion.
(3) The crontab command usually takes several minutes to run. Please wait. After the change, I found that there was no change. This is normal. Just wait.