-
- @echo off
- rem "set the infos below, then it can be performed."
- rem "===================================="
- rem "PLEASE set the path of sql files"
- @set script_path=C:/temp
- rem "PLEASE set the connection of db server"
- @set db_conn=dbusername/dbpassword@dbsid
- rem "===================================="
- rem "get the time string "
- @set timeS=%DATE:/=%%TIME::=%
- rem "get the time string "
- @set tmpf=tmp%timeS:~0,14%.sql
- @set logf=log%timeS:~0,14%.txt
- rem "specify the log file "
- @echo spool %logf% >> %tmpf%
- rem "only the error msg"
- rem @echo set feedback off >>%tmpf%
- rem "copy the sql file to tmpfile "
- @for /R %script_path% %%a in (*.sql) do (
- type %%a >> %tmpf%
- echo.>> %tmpf%
- )
- rem "write print log command to tmpfile "
- @echo spool off >> %tmpf%
- rem "write exit; to tmpfile "
- @echo exit; >> %tmpf%
- rem "perform the sqls "
- @sqlplus %db_conn% @%tmpf%
- rem "del the tmpfile "
- @del %tmpf%
- @echo on