Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

  • Translate

  • It’s Me






  • My Certificates

  • Links

    My Acclaim Certification : Credly Profile
    My Oracle ACE Pro Profile

  • Achievements

    Awarded Top 100 Oracle Blogs from Worldwide - #RANK 39
  • VISITORS COUNT

  • Verified International Academic Qualification from World Education Service (WES)

    Verified International Academic Qualification from World Education Service (WES)

  • Jobs

Configure RMAN backup using crontab

Posted by Mir Sayeed Hassan on October 4th, 2017

Configure RMAN backup using crontab

[oracle@localhost ~]$ crontab -l

##############################################################
#Script Used To Create Hourly Exports Of  prm database Schemas_Synaps
###############################################################
00 20 * * 0-7 /backup/Daily_Schema_dump/dumpfile.sh testdb >/dev/null
#################################
#RMAN BACKUP - Level 0 & Level 1
#################################
0 22 * * 2 /home/oracle/scripts/tuesday
0 22 * * 3 /home/oracle/scripts/wednesday
0 22 * * 4 /home/oracle/scripts/thursday
0 22 * * 5 /home/oracle/scripts/friday
0 22 * * 6 /home/oracle/scripts/saturday
0 22 * * 0 /home/oracle/scripts/sunday
0 22 * * 1 /home/oracle/scripts/monday

 ========

LEVEL – 0

=========

[oracle@localhost scripts]$ cat friday
export ORACLE_SID=testdb
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target sys/xxxx@testdb nocatalog@/home/oracle/scripts/friday.rcv > /backup/rman/friday_level_0/rman`date +%F`.log
[oracle@localhost scripts]$ cat friday
export ORACLE_SID=testdb
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target sys/xxx@testdb nocatalog@/home/oracle/scripts/friday.rcv > /backup/rman/friday_level_0/rman`date +%F`.log
[oracle@localhost scripts]$ cat friday.rcv

run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
allocate channel c6 device type disk;
CROSSCHECK ARCHIVELOG ALL;
CROSSCHECK BACKUP;
CROSSCHECK COPY;
backup as compressed backupset incremental level 0 database tag friday_level_0 format '/backup/rman/friday_level_0/df_%d_%T_%s.bck';
backup as compressed backupset archivelog all format '/backup/rman/friday_level_0/arch_%d_%T_%s.bck' delete input;
backup spfile format '/backup/rman/friday_level_0/spf_%d_%T_%s.bck';
backup current controlfile format '/backup/rman/friday_level_0/ctlfileL0_%d_%T.bck';
delete noprompt obsolete;
}
exit;

========

LEVEL – 1

=========

[oracle@localhost scripts]$ cat Monday
export ORACLE_SID=testdb
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
/u01/app/oracle/product/11.2.0/dbhome_1/bin/rman target sys/xxx@testdb nocatalog@/home/oracle/scripts/monday.rcv > /backup/rman/monday_level_1/rman`date +%F`.log
 [oracle@localhost scripts]$ cat monday.rcv

run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
allocate channel c6 device type disk;
CROSSCHECK ARCHIVELOG ALL;
CROSSCHECK BACKUP;
CROSSCHECK COPY;
backup as compressed backupset incremental level 1 cumulative database tag monday_level_1 format '/backup/rman/monday_level_1/df_%d_%T_%s.bck';
backup as compressed backupset archivelog all format '/backup/rman/monday_level_1/arch_%d_%T_%s.bck' delete input;
backup spfile format '/backup/rman/monday_level_1/spf_%d_%T_%s.bck';
backup current controlfile FORMAT '/backup/rman/monday_level_1/ctlfileL1_%d_%T_%s.bck';
delete noprompt obsolete;
}
exit;

Similarly can configure for other days for incremental level 1