Transcript
Page 1: Linux Shell Script to Backup Oracle database using RMAN

Linux Shell Script to Backup Oracle database using RMAN

First of all, I have created a shell script named backup_script.sh which contains the actual sequence of commands to backup the database.

[oracle@testmn ~]$ cat backup_script.shrun{crosscheck backup;delete expired backup;delete obsolete;allocate channel ch1 type disk;backup database format '/backups/hot_backups/daily_bk_%d_%T_%U';backup archivelog all format '/backups/hot_backups/archivelog_%d_%u_%s_%T' not backed up 2 times;delete noprompt archivelog all backed up 5 times to disk completed before 'sysdate-7';release channel ch1;}

[oracle@testmn ~]$

Now, I have created another shell script named rman_exe.sh which will start the RMAN session and call the above shell script as the above created shell script.

[oracle@testmn ~]$ cat rman_exc.sh#!/bin/bashrman target/ @/home/oracle/backup_script.sh

[oracle@testmn ~]$

Now, run this script checking whether it's working:

[oracle@testmn ~]$ sh rman_exc.sh

Recommended