In a real environment, off
course you will not manually trigger all the Oracle database backups. You need
an automated mechanism to trigger RMAN backups. So in this topic we will learn
how to set RMAN backup automation using shell scripts.
Schedule Backup Under
Crontab
Give
execute permissions on the shell script
chmod 775 /u01/backup/BKP_DEV_05172023/full_backup.sh
Now you can go ahead and
schedule the backup under the crontab. For example, we are
scheduling backup to trigger every Tuesday and Friday at midnight
crontab -e
Crontab tool
Her is the crontab tool I
use (https://crontab.guru/ )that I use to accurately
define when crontab will execute next.
Cron Job Schedule Syntax
A basic crontab entry looks something like this:
* * * * * /home/user/bin/somecommand.sh
| | | | | |
| | | | | Command or Script to execute
| | | | |
| | | | Day of week(0-6 | Sun-Sat)
| | | |
| | | Month(1-12)
| | |
| | Day of Month(1-31)
| |
| Hour(0-23)
|
Min(0-59)
An asterisk (*) matches all values, so if you take a look at the example above, it specifies that /home/user/bin/somecommand.sh should be run at minutes 0-59 and hours 0-23 on days of the month 1-31 for months 1-12 on days of week 0-6 — or in other words "every minute".
Cron entries can also be configured to run at more complex times. If you want to run four times a day between Monday and Friday, you can use the step operator ( / ) and the range operator ( - ).
No comments:
Post a Comment
Please do not enter any spam link in the comments