DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Thursday, December 29, 2016

Shell Script to Run RMAN Backup in Background with nohup





Please find the below steps.


Step 1. Prepare a RMAN command file


vi bkup.cmd
run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
       configure retention policy to recovery window of 7 days;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 4;
CONFIGURE COMPRESSION ALGORITHM 'MEDIUM';
CROSSCHECK BACKUP DEVICE TYPE DISK;
CROSSCHECK ARCHIVELOG ALL;
delete noprompt archivelog all backed up 1 times to device type disk;
backup incremental level 0 as compressed backupset  database archivelog all   tag level0_weekly_ backup delete input;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED BACKUP;
release channel ch1;
release channel ch2;
}


Step 2. Create a shell script to invoke RMAN

vi bkup.ksh
#!/bin/ksh
export ORACLE_SID=ORCL1
export ORACLE_HOME=/u01/oracle/product/database/11.2.0/db_ORCL
export PATH=$PATH1:$ORACLE_HOME/bin
rman catalog rman/rmanPWD@rmancat target rmanbkup/RMANBKUP@mxcrm1e msglog /home/oracle/rman/rman_bkup.log cmdfile=/home/oracle/rman/bkup.cmd


Step 3. Invoke the script using nohup

          Change the permission of the shell script.
chmod 744 bkup.ksh
nohup ./bkup.ksh &





No comments: