Hi ,
In windows server environment we use scheduler(cronjob in unix environment) to schedule a job.
Note:Please make sure you have enough space in the drives(disks in unix environment) before scheduling the jobs.
The important steps here are as follows:
FULL DATABASE BACKUP(INCREMENTAL LEVEL O):
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;
}
INCREMENTAL BACKUP(LEVEL1,LEVEL2,LEVE3 BACKUP):
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
ARCHIVE LOGS BACKUP: AND CONTROLFILE BACKUP
Finally,It is good practice to take archives backup,It can be done as follows:
TESTDB_archives_backup.cmd:
Run{
Crosscheck Archivelog All;
Sql 'alter system archive log current';
Allocate channel t1 device type disk;
Delete Noprompt Copy of Archivelog All Completed before 'SYSDATE-1';
Backup Format 'D:\oracle10g\oradata\TESTDB\Archives\%d_ARCH_%U_%T' Archivelog All;
Release Channel t1;
Allocate channel ch1 device type disk FORMAT 'D:\oracle10g\oradata\TESTDB\Archives\%d_CTRL_%U_%T';
Backup Current Controlfile;
Release channel ch1;
}
TESTDB_archives_backup.bat:
set ORACLE_SID=TESTDB
rman target sys/TESTDBDBA@TESTDB cmdfile=D:\backup\TESTDB_archives_backup.cmd log=D:\backup\Log\backup_archives_TESTDB_%date:~4,2%_%date:~7,2%_%date:~10%.log
Hope this helps.
Best regards,
Rafi.
No comments:
Post a Comment