RMAN Backup Shell Script to Run in Background with nohup.
Step 1. Prepare a RMAN command file
vi rman_bkup.cmd
allocate
channel ch1 device type disk;
allocate channel ch2 device type disk;
allocate channel ch2 device type disk;
allocate
channel ch3 device type disk;
sql
'ALTER SYSTEM ARCHIVE LOG CURRENT';
sql ‘ALTER
SYSTEM SWITCH LOGFILE’;
sql ‘ALTER
SYSTEM SWITCH LOGFILE’;
sql ‘ALTER
SYSTEM SWITCH LOGFILE’;
configure
retention policy to recovery window of 8 days;
CONFIGURE
DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 8;
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;
release channel ch2;
release
channel ch3;
}
Step 2. Create a shell script to run
RMAN
vi rman_bkup.ksh
#!/bin/ksh
export
ORACLE_SID=ORCL1
export
ORACLE_HOME=/u001/oracle/product/database/11.2.0/db_ORCL
export
PATH=$PATH1:$ORACLE_HOME/bin
rman
target system/++++++ msglog /home/oracle/rman/rman_bkup.log
cmdfile=/home/oracle/rman/rman_bkup.cmd
Step 3. Run the script using nohup
Change the permission of the shell script.
chmod
744 rman_bkup.ksh
nohup
./rman_bkup.ksh &
Nice blog
ReplyDelete