Friday, March 10, 2017

RMAN Backup Shell Script for Oracle

This hassle free RMAN backup Shell script helps the DBA to take an on-demand self-contained & consistent RMAN backup for Oracle database resides on Linux OS. It will help to easily specify the number of channels, select backup options (Compression/Encryption) and then it will run in the background in nohup mode.

Script download:

How it works:

This script should run by the Oracle installation owner (e.g. oracle) it will do the following:
 - Will ask you to select the database number you want to backup from the list (in case multiple databases found).
 - Then it will ask for the backup location, and the number of channels to be allocated during the backup.
 - Then you will be asked to use special features such as Compression and Encryption for the backup.
 - Finally, RMAN script will be created and will run automatically in the background in nohup mode, and thus no need to bother about your session disconnect during the backup operation.


  1. I can see that in your script you are using "change archivelog all crosscheck" while it's not recommended, see this:

  2. Hi,
    Thanks for your comment.
    Actually I read the article and it's totally true from the theory perspective but practically this is not the case; Nowadays DBAs are managing hundreds of databases when a backup fail the DBA should interact quickly (which is difficult to do so) before the backup window get passed because most probably the next full backup window will be after a day or a week! The thing will impact the DB recoverability. Moreover, it never happens (at least for me) to investigate a case where archivelogs got deleted using OS commands from the disk (before getting backed up) and I managed to restore them back! When archivelog files accidentally get deleted using OS command it's almost impossible to restore them back; so the life should go on and the backup should not miss its window. This is my humble opinion.

  3. Thanks for sharing this insightful post. Do you happen to have a script to assist with the recovery from this backup?

  4. Thanks for your comment.

    Actually I don't develop/share scripts that may cause wide change to the database, because it may cause damages if they get used wrongly, moreover, bugs can be there as well, as I cannot test the scripts on all sorts of environments. Thanks for your understanding.

  5. pwdx show permission denied on oracle linux 7, any solution for this?

    1. Please hash line# 118 in the script:

      #ORACLE_HOME=`pwdx ${PMON_PID}|awk '{print $NF}'|sed -e 's/\/dbs//g'`