Why a scheduled recurring Window task never finish running?

In Windows Task scheduler a batch file is scheduled to run everyday at 6am. The first day the job ran successfully (which kicked off some other processes) in < one minute. However the second day the status shows "running" persistently and the jobs that supposed to be kicked off by the batch file never got kicked off.

The batch job is scheduled to run every week day at 6am. It's now after 12 noon and it is sitll "running". Are there anything that I am missing?

The batch file is as follows:

@ECHO OFF
DEL C:\AT_Batch\at_spool.txt
sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql"

Thanks.
HKBoyzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ECNSSMTCommented:
just a shot in the dark. as a test add RUN or CALL in front of the sql statement

(I forget which in NT was used to run an executable)

RUN sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql"

and test

if the sql ran successfully and stopped.  I wonder if there is an open file issue with the BAT file that is preventing task scheduler from detecting a successful conclusion of the job.  I believe RUN (or CALL) should somehow permit the BAT file to close after the BAT is executed.  It has been a while.

Regards
0
HKBoyzAuthor Commented:
Hi

Thanks for the input. I tested both RUN and CALL. These are the results:

RUN:
After each successful scheduled run it did stop running. However, it didn't generate the output file as expected (ie. it didn't exec. the 3rd line in the batch file as listed below). It did delete the file, but no new file has been generated. (the at_sql.sql script will generate an output file if run successfully.

@ECHO OFF
DEL C:\AT_Batch\at_spool.txt
RUN sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql"

CALL:
It worked exactly the same as if with out CALL in the third line. Its status remains "running" after first scheduled run. Therefore it never kick off the second or any subsequent scheduled run. (however first scheduled run was success and t did exec. the sql file and generated the output file).

@ECHO OFF
DEL C:\AT_Batch\at_spool.txt
CALL sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql"

Any other hints??
0
ECNSSMTCommented:
Hi HKBoyz,

sounds like the CALL command was the way to go.  If I remember correctly when you execute a BAT file from an existing BAT file, there is issues of how the BAT file allocated memory for this.  But since the CALL didn't worked to the point of the original statement, it would be interesting to see what the sql statement houses.  I am guessing, but if you ran sqlplus pinprd/pintst_pin05@xm_pintst  @"C:\AT_Batch\at_sql.sql" from a command line, what happens?  Does it stay in sql after the command finishes? Does it stay in SQL?  If so what happenswhen you either add a "QUIT" or "EXIT" to the end of the sql job?

regards,
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HKBoyzAuthor Commented:
Added "Exit" in the SQL file and now it's all working fine.
Thanks.
0
ECNSSMTCommented:
cool.  I've been busy the last few days with tech issues of my own. but I'm glad that worked out.

And thanks for the points.

Regards
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.