Simple RMAN script to take cold database backup


mkdir -p /BACKUP/PROD
 mkdir -p /BACKUP/PROD/log
$cold_backup.sh
 export ORACLE_HOME=/u01/app/oracle/product/11.2.0
 export ORACLE_SID=PROD
 export PATH=$ORACLE_HOME/bin:$PATH
 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
 rman target / log=/BACKUP/PROD/log/PROD`date +%d%m%Y`.log <<EOF
 sql ‘alter system checkpoint’;
 shutdown immediate;
 startup mount;
 sql “create pfile=”/BACKUP/PROD/pfile`date +%d%m%Y`.ora” from spfile”;
 RUN {
 ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT ‘/BACKUP/PROD/%U’;
 ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT ‘/BACKUP/PROD/%U’;
 ALLOCATE CHANNEL disk3 DEVICE TYPE DISK FORMAT ‘/BACKUP/PROD/%U’;
 BACKUP AS COMPRESSED BACKUPSET DATABASE;
 BACKUP CURRENT CONTROLFILE FORMAT ‘/BACKUP/PROD/cntrl_%s_%p_%t’;
 RELEASE CHANNEL disk1;
 RELEASE CHANNEL disk2;
 RELEASE CHANNEL disk3;
 }
 script execution:
 ./cold_backup.sh
Advertisements

2 comments

  1. “alter database open” at the end?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: