RedHat 常用备份脚脚本示例
———-全备————-
#!/bin/bash
#edit by hsxiao 2010-03-30
date
echo ‘begin backup database…….’
echo ‘***********************************************’
export Oracle_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=HSXIAO
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
rman target / <<EOF
backup database plus archivelog delete all input;
#backup tablespace crawler;
EOF
date
echo ‘***********************************************’
echo ‘end! backup database successfull!’
————-单备表空间—————————-
#!/bin/bash
#edit by hsxiao 2010-03-30
date
echo ‘begin backup database…….’
echo ‘***********************************************’
export ORACLE_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=HSXIAO
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
rman target / <<EOF
#backup database plus archivelog;
backup tablespace crawler format ‘/usr/datafile/backup/crawler_%U.dbf’;
EOF
date
echo ‘***********************************************’
echo ‘end! backup database successfull!’
————清除失效备份——————–
#!/bin/bash
#edit by hsxiao 2010-03-30
date
echo ‘begin backup database…….’
echo ‘***********************************************’
export ORACLE_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=HSXIAO
export PATH=/usr/sbin:$ORACLE_HOME/bin:$PATH
rman target / <<EOF
# crosscheck and delete expired or obsolete backup;
crosscheck backup;
delete noprompt obsolete;
EOF
date
echo ‘***********************************************’
echo ‘clear backup for database successfull!’