存储过程自动备份脚本

#!/bin/bash
source $HOME/.bash_profile
 
today=`date +%Y%m%d`
workdir=$HOME/scripts/bak/proc/
 
proc_bak=$HOME/scripts/bak/proc/proc_bak_$today
cd $workdir
sqlplus -S tpss/AAA@orcl <<EOF
 
 
        set feedback off
        set verify off
        set term off
        set heading off
        set serveroutput on
        set pagesize 0
        set linesize 150
        set trimout on
        set trimspool on
        spool $proc_bak
 
        select sysdate from dual;
 
        select text from user_source a where (name like 'PRO%' or name like 'PRC%') and text is not null;
 
        spool off

exit;
 
EOF






posted @ 2014-02-25 21:02  bowshy  阅读(270)  评论(0编辑  收藏  举报