Connect to sqlplus in a shell script and run SQL scripts

前端 未结 5 889
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 01:24

I have a .sql file, which is a bunch of oracle pl/sql commands and I want to create a shell script to run these commands.

Suppose that user/pass@server

5条回答
  •  时光取名叫无心
    2020-11-30 01:53

    Wouldn't something akin to this be better, security-wise?:

    sqlplus -s /nolog << EOF
    CONNECT admin/password;
    
    whenever sqlerror exit sql.sqlcode;
    set echo off 
    set heading off
    
    @pl_script_1.sql
    @pl_script_2.sql
    
    exit;
    EOF 
    

提交回复
热议问题