bash nohup 执行ORACLE SQL

来源:互联网 发布:专业家具建模软件 编辑:程序博客网 时间:2024/06/16 19:57

su - oracle

touch ss.sh

vi ss.sh

#!/bin/bash

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1

export ORACLE_SID=jsdb1

export PATH=/u01/app/oracle/product/11.2.0.3/dbhome_1/bin:/usr/local/bin

sqlplus -S cjcl/cjclpassword << EOF

spool /home/oracle/Scripts/20140730.sh.log

set serverout on

set timing on

exec dbms_output.put_line(to_char(sysdate,’yyyy-mm-dd hh24:mi:ss’));

UPDATE CJCL.C2013_000000_611_1 A

SET A.B191 = (

CASE WHEN NVL(A.B1921,0) >= 300 THEN ‘1’

ELSE CASE WHEN NVL(A.B1921,0) >= 100 AND NVL(A.B1921,0) < 300 THEN ‘2’

ELSE CASE WHEN NVL(A.B1921,0) >= 10 AND NVL(A.B1921,0) < 100 THEN ‘3’

ELSE CASE WHEN NVL(A.B1921,0) < 10 THEN ‘4’

ELSE ”

END

END

END

END

)

WHERE bgq=’201301YY’ and substr(zzjgdm,1,2) IN (‘11’,’12’,’21’,’31’,’32’,’34’,’44’) AND (

SUBSTR(A.B103,1,2) IN (‘73’,’74’,’75’,’76’,’77’,’78’,’79’,’80’,’81’,’84’,’85’,’86’,’87’,’88’,’89’)

OR

SUBSTR(A.B103,1,3) IN (‘703’,’709’)

) ;

commit;

spoo off

EOF

nohup /home/oracle/ss.sh > /home/oracle/ss.log

原创粉丝点击