Oracle 11g-运行Windows批处理文件以在sqlplus中运行多个sql文件 [英] Oracle 11g - run windows batch file to run multiple sql files in sqlplus
本文介绍了Oracle 11g-运行Windows批处理文件以在sqlplus中运行多个sql文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用一个批处理文件来按顺序执行多个sql.IE:sql2脚本调用由sql1脚本创建的表.等等.
I would like to use a single batch file to execute multiple sql in a sequence.. IE: sql2 script calls a table created by sql1 script.. etc..
这是我到目前为止的批处理代码.它可以运行单个sql文件,但我需要它先运行第一个文件,然后再运行下一个文件.预先感谢.
here is the batch code I have so far.. it works to run a single sql file but I need it to run the first one and then then next.. thanks in advance.
@ECHO OFF
echo.
echo.
SET /P uname=Username:
echo.
echo.
SET /P pass=Password:
echo.
echo.
SET /P mydatabase=Database:
echo.
echo.
set oracle_sid=ins
sqlplus -s %uname%/%pass%@%mydatabase% @J:/A/scripts/_TABLES/Table1_.sql \n
sqlplus -s %uname%/%pass%@%mydatabase% @J:/A/scripts/_TABLES/Table2_.sql \n
sqlplus -s %uname%/%pass%@%mydatabase% @J:/A/scripts/_TABLES/Table3_.sql \n
sqlplus -s %uname%/%pass%@%mydatabase% @J:/A/scripts/_TABLES/Table4_.sql \n
sqlplus -s %uname%/%pass%@%mydatabase% @J:/A/scripts/_TABLES/Table5_.sql \n
sqlplus -s %uname%/%pass%@%mydatabase% @J:/A/scripts/_TABLES/Table6_.sql \n
sqlplus exit
pause
推荐答案
制作一个驱动程序" sql脚本.
make a 'driver' sql script.
里面看起来像这样:
@Table1_.sql
@Table2_.sql
@Table3_.sql
@Table4_.sql
然后只需在操作系统中调用一次即可
then just call this one once from the OS
这篇关于Oracle 11g-运行Windows批处理文件以在sqlplus中运行多个sql文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文