I am trying to write a simple batch program to run my analyze script once a week. I have the analyze.sql, that was the easy part.
What I want to do is create a batch program that will log into SQL and call the .SQL script I have created.
I have gotten as far as getting the .CMD to log on to the correct instance but how do you get it to call the .sql script once you are in a sql session?
why not schedule through dbms_jobs, the logic would be encapsulated in the database and would be portable, ie.. if you moved the db to a new machine or a new OS you would not have to worry about an extra .bat and .sql file or having to rewrite the .bat file if you ever moved to unix.
I have sample code if you want to me to post for scheduling analyze in dbms_jobs
Thanks guys, as we can tell my scripting abilities are near nill.
Jovery, that works and I tried it before...honest.
For some reason it does not work when I call the script on the next line, am I missing something here?
Originally posted by Mr.Hanky
sqlplus Mr.Hanky/X-maspoo@xxx.oracledb.blah.com
@C:\test_sql.sql
This does not execute the second line, if I put it on one line it works fine.
MH
If you type @c:\test_sql.sql from a c:> prompt would it run? Of course not. By the time the Command Intrepreter gets to @c:\test_sql.sql the sqlplus command is already done.
This would tell the command intrepreter to continue reading the following stream as input until you reach the string "EOF". I don't waste my time with WindoZ, so I can't tell you if DOS (which WindoZ is really based on) has a way to do redirection.
Bookmarks