首页 > 技术文章 > 存储过程自动备份脚本

bowshy 2014-02-25 21:02 原文

#!/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




来自为知笔记(Wiz)


推荐阅读