Here are the steps making Linux shell scripts to backup oracle database using RMAN.
First of all, I have created a shell script named rmanfullbak.sh which contains the actual sequence of commands to backup the database.
[oracle@rac1 ~]$ cat rmanfullbak.sh
run{allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
backup as compressed backupset archivelog all not backed up delete input;
backup as compressed backupset database;
release channel c1;
release channel c2;
release channel c3;
}
[oracle@rac1 ~]$
Note: - You can modify this shell script as per your requirement like backup format.
#!/bin/bash
rman target / @/home/oracle/rmanfullbak.sh >>rmanback.log
Now, you can run this script checking whether it's working the way we want.
[oracle@rac1 ~]$ ./rmanbak.sh
Finally, you can make sure what did this script do after executing by looking at rmanback.log file which records the screen log produced by this operation.
Now, We will schedule it to run automatically on specified time interval using CON Job command.
[oracle@rac1 ~]$ crontab -e
20 10 * * * /home/oracle/bkpscript/rmanbak.sh
It will execute on 10:20AM every day.
Hope it will help someone!
...................................!!