https://www.dropbox.com/home?preview=schedule_rman_full_bkp.sh
In case you are interested in an interactive script to run it manually then use this script:
https://dba-tips.blogspot.com/2017/03/rman-backup-script.html
For the first script before you schedule it to run in the crontab you have to do the following:
Modify the following mandatory parameters at the top of the script to match your database environment details you want to back up:
ORACLE_SID=orcl The instance name you want to back up. i.e. orcl
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 The Oracle Home location i.e. /u01/app/oracle/product/11.2.0/dbhome_1
BACKUPLOC=/backup The Backup location “Full path”. i.e. /backup
If you still have time you can modify the optional parameters:
COMPRESSION=Y In case you want to enable compression i.e. enabled
BKP_RETENTION=7 Backups older than 7 days will be deleted. [MAINTENANCEFLAG must =Y for this parameter to take effect]
ARCH_RETENTION=7 Archivelogs older than 7 days will be deleted. [MAINTENANCEFLAG must =Y for this parameter to take effect]
CTRL_AUTOBKP_RETENTION=7 Controlfile autobackup files older than 7 days will be deleted. [MAINTENANCEFLAG must =Y for this parameter to take effect]
MAINTENANCEFLAG=N If enabled it will perform the following tasks: [Default Disabled]
– Enable CONTROLFILE AUTOBACKUP mode.
– Enable backups to be resumed if crashed.
– Maintain the good naming of the CONTROLFILE backup piece.
– Crosscheck old backups.
– Crosscheck Archivelog files.
– Delete Expired old backups from the disk. [Based on the Backup retention you defined]
– Delete Obsolete backups which are no more exist from the catalog.
– Delete the old Archivelogs. [Based on the Archivelog retention you defined]
– Delete the old Controlfile backups. [Based on the Controlfile retention you defined]
That’s all!
This script is part of the DBA BUNDLE, to read more about it please visit this link:
http://dba-tips.blogspot.ae/2014/02/oracle-database-administration-scripts.html
DISCLAIMER: THIS SCRIPT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY. IT IS PROVIDED “AS IS”.
GitHUB Version:
Mahmmoud can you describe good rman backup strategies for large databases?
This depends on how much time the backup will take, backup storage cost/license and how critical the DB is and it's Service Level Agreement (SLA).
In general, For the DBs that take less than 2 hours to fully backup, I prefer to have a daily Incremental 0 backup and archivelog backup every 1-4 hours (depends on the SLA's).
For the DBs that takes longer than 2 hours for a full backup I prefer the following:
– Incremental 0 backup once a week.
– Incremental 1 backup every day.
– Archivelogs backup every 4 hours.
I always prefer keeping the archivelogs on disk for at least 24 hours, UNDO RETENTION from 6 to 24 hours and keep FLASHBACK ON as possible.
it would be perfect if yu include incremental strategy and sbt support
is it possible to include incremental / tape support in the script ?
Hi Sam,
Honestly I would like to make the script compatible with tape backup but this is very difficult to accomplish, because every Media Management software has it own unique parameters that need to be passed to the script. e.g. here are the parameters that are need for one Media Management software "HPDP"
parms 'SBT_LIBRARY=xxxx
send channel 'ch1' 'OB2BARTYPE=xxxx';
send channel 'ch1' 'OB2APPNAME=xxxx'
send channel 'ch1' 'OB2BARLIST=xxxx;
It's almost impossible for me to speculate the right parameters for each Media Management software, because they are a lot, moreover many of these parameters values are being changed based on how the Media Management software (either Server or Client) been set up; each environment has its own specific settings.
I believe it's better to leave the user to change the channel parameters himself in case he/she wants to back up to a tape.
Hi Mahmmoud , Thanks for the feedback . you dont need to make any fixed parameters for tape , its just a parameter if its tape backup let the user define the channel | env parameters manually like $ORACLE_SID , $ORACLE_HOME … etc
and how about the incremental backup option ?
thanks for your support.
Regards,
Sam