Membuat RMAN dengan crontab


Berikut saya paparkan bagaimana membuat script RMAN sang akan dijalanakan secara terjadwal dan otomatis dengan menggunakan crontab

Langkah langkahnya sebagai berikut

1. Membuat file fullbackup_rman.sh

* * * * * /home/oracle/scripts/fullbackup_rman.sh >/home /oracle/oracle_backup/fullbackup_rman.log
====================================
#vi fullbackup_rman.sh
ORACLE_SID=training;
export ORACLE_SID
ORACLE_HOME=/home/oracle/base/db_1
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin:/usr/ucb:/etc:.;
export PATH
rman target=/ @/home/oracle/scripts/fullbackup_script.conf -> path tempat menaruh script RMAN

2. Membuat file fullbackup_script.conf
contoh script RMAN yang akan dijalankan.

#vi /home/oracle/scripts/fullbackup_script.conf
run
{
allocate channel ch1 type disk;
backup
incremental level 0
filesperset 1
format '/home/oracle/oracle_backup/data_%T_d%d_p%p_U%U.bak'
(database);
backup
incremental level 0
format ‘/home/oracle/oracle_backup/cf_%T_d%d_p%p_U%U.bak’
(current controlfile);
delete noprompt obsolete;
}
exit;

Cara membuat Crontab file
___________
Crontab syntax :-
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)

* in the value field above means all legal values as in braces for that column.

The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).

Note: The specification of days can be made in two fields: month day and weekday. If both are specified in an entry, they are cumulative meaning both of the entries will get executed .

3. Membuat Crontab untuk menjalankan RMAN

Contoh crontab ini akan menjalankan script /home/oracle/script/fullbackup_rman.sh dan membuat log di /home/oracle/oracle_backup/fullbackup_rman.log
setiap hari pada jam 6:30 PM.

30 18***** /home/oracle/script/fullbackup_rman.sh > /home/oracle/oracle_backup/fullbackup_rman.log
=================================
$ chmod 775 fullbackup_rman.sh
$ crontab -e => 30 18 * **/home/oracle/script/fullbackup_rman.sh>/hoem/oracle/oracle_backup/fullbackup_rman.log
$ crontab -l
=================================

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s