ORACLE 全备份脚本

#!/bin/bash 
export ORACLE_SID=prd
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export NLS_LANG=american_america.AL32UTF8
backtime=`date +"20%y%m%d%H%M%S"`
$ORACLE_HOME/bin/rman target /   log=/oracle/backup/log/full_backup_$backtime.log < run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
crosscheck backup;
sql 'alter system archive log current'; 
backup database format '/oracle/rmanbk/db_%d_%T_%U'; 
sql 'alter system archive log current';
backup archivelog all format '/oracle/rmanbk/arc_%t_%s' delete all input;
backup current controlfile format '/oracle/rmanbk/cntrl_%s_%p_%s'; 
crosscheck archivelog all; 
delete noprompt expired backup;
delete noprompt obsolete;
delete noprompt backup of database completed before 'sysdate - 30'; 
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
EOF

你可能感兴趣的:(Oracle备份与恢复)