1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| #!/bin/bash # export ORACLE_BASE=${ORACLE_BASE} export ORACLE_HOME=${ORACLE_HOME} export ORACLE_SID=$1 export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH backuptime=`date +"%Y%m%d-%H%M%S"` backuppath=/tmp/backuporacle if [ ! -d ${backuppath} ];then sudo mkdir -p ${backuppath} else : fi
$ORACLE_HOME/bin/rman target / log=${backuppath}/full_backup_${backuptime}.log <<EOF 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; sql 'alter system archive log current'; backup as compressed backupset full database format '/tmp/backuporacle/db_%d_%T_%U'; sql 'alter system archive log current'; backup archivelog all format '/tmp/backuporacle/arch_%d_%T_%s_%p.bak' delete all input; backup current controlfile format '/tmp/backuporacle/ctl_%d_%T_%s_%p.bak'; delete noprompt obsolete; release channel c1; release channel c2; release channel c3; release channel c4; }
exit
EOF
|