How to schedule a backup jobs?
Backup strategy we follow for one of our production Database
is as follows:
1) Weekly RMAN full backup
2) Weekly Archive log backup
3) Daily incremental backup
In windows server environment we use scheduler (cronjob
in unix environment) to schedule a job.
The important steps here are:
Taking Database backup weekly(incremental level 0):
1) Create a cmd file(command file):
Let us create a file name backup_weekly_db1.cmd using
a text file editor(any editor) write the rman script to take the backup.Suppose
I want to take full backup(incremental 0) than the script for taking the
weekly incremental 0 backup would be like this,assuming controlfile autobackup
is off(default).
backup_weekly_db1.cmd
RMAN>run{
Allocate channel ch1 type disk format '\path of taking
backup_\%d_data_%U';
Backup incremental level=0 database tag='complete_backup';
Release channel ch1;
Allocate channel t1 type disk format '\path of taking
backup\%d_ctrl_%U';
Backup current controlfile;
Release channel t1;
}
2) Create the bat file(Batch file is for batch job execution
by scheduler)
Let us create a batch file backup_weekly_db1.bat(This
batch file we are creating for executing this file through schedule (as
cronjob in unix environment).
The script is:
backup_weekly_db1.bat
rman target sys/db1@db1
cmdfile=\Path of cmd file\backup_weekly_db1.cmd
log=D:\Path of log keeping\backup_complete_db1_%date:~4,2%_%date:~7,2%_%date:~10%.log
3) Use scheduler for scheduling job:
Go to control panel->scheduler tasks->Add scheduler task->command
prompt->Perform this task->weekly->choose day and timings when you want
to run this job weekly->specify administrator user and password->finish
Taking Database backup Daily(incremental level 1)
All the above steps remain the same,but the scripts and
scheduler task option changes slightly:
1) backup_daily_db1.cmd
run{
Allocate channel ch1 type disk format '\path of taking
backup_\%d_data_%U';
backup incremental level=1 database tag='Incremental_Backup';
Release channel ch1;
}
2) backup_daily_db1.bat
rman target sys/db1@db1
cmdfile=\Path of cmd file\backup_daily_db1.cmd
log=D:\Path of log keeping\backup_complete_db1_%date:~4,2%_%date:~7,2%_%date:~10%.log
3) Scheduler option choose daily and timings when you
want to schedule the job |