在外壳程序脚本中连接到sqlplus并运行SQL脚本 [英] Connect to sqlplus in a shell script and run SQL scripts
本文介绍了在外壳程序脚本中连接到sqlplus并运行SQL脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个.sql文件,该文件是一堆oracle pl/sql命令,并且我想创建一个Shell脚本来运行这些命令.
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.
假设user/pass@server
是我的凭据.完成该任务的Shell脚本将是什么?
Suppose that user/pass@server
is my credentials. What will be the shell script to do such a task?
推荐答案
例如:
sqlplus -s admin/password << EOF
whenever sqlerror exit sql.sqlcode;
set echo off
set heading off
@pl_script_1.sql
@pl_script_2.sql
exit;
EOF
这篇关于在外壳程序脚本中连接到sqlplus并运行SQL脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文