bat 文件 执行 sql 并且使用 spool 来保存日志

C:\Users\a528692>C:\Users\a528692\Desktop\temp\runSQL.bat gcedba gcedba C:\Users\a528692\Desktop\temp\PB\201606020002_ZX_test.sql C:\Users\a528692\Desktop\temp\PB\gc_db  10.248.156.165:1521/ORCL.corp.statestr.com


命令行需要用 \ 的斜杠,


C:\Users\a528692\Desktop\temp\runSQL.bat

@echo off
cd %4
sqlplus -s %1/%2@%5 as sysdba @%3

echo 1
exit




C:\Users\a528692\Desktop\temp\PB\201606020002_ZX_test.sql
spool c:/log/init.log;  
@GCE_METRICS/Alter_Tables/update_test_sql.sql --34741
@GCE_METRICS/Alter_Tables/update_test_sql2.sql --34741
SPOOL OFF;

 

提示: spool 命令需要在 sql文件中,如果是在sql plus 也是直接在sql plus 命令行中。

猜你喜欢

转载自dannyhz.iteye.com/blog/2283237