Home » Infrastructure » Windows » schedule job
schedule job [message #242113] Thu, 31 May 2007 12:35 Go to next message
plshelp
Messages: 205
Registered: January 2007
Senior Member
Hi all,

Please,can someone advise how to schedule a job to run every half hour on my local windows machine. The schedule job is to check if the databases are up and running. Right now I am just running a script manually from sqlplus to check the status of the databases. I know cronjob in unix, but I dont know in windows..
Thanks much!
Re: schedule job [message #242128 is a reply to message #242113] Thu, 31 May 2007 13:54 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Programs - Accessories - System tools - Scheduled tasks - double click "Add Scheduled Task" and ... well, schedule a task.
Re: schedule job [message #242129 is a reply to message #242113] Thu, 31 May 2007 14:00 Go to previous messageGo to next message
plshelp
Messages: 205
Registered: January 2007
Senior Member
ok..I tried scheduling sqlplusw.exe every 20minutes. I scheduled to run sqlplus. But how do I schedule to run the script from sqlplus?? Please help.Thanks.
Re: schedule job [message #242139 is a reply to message #242129] Thu, 31 May 2007 14:39 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You'll need two files: one will be an SQL script and another MS Windows BAT script; something like this:
REM TEST.SQL

SPOOL test.txt
SELECT * FROM dual;
SPOOL OFF;
EXIT;
REM JOB.BAT

SQLPLUS -S scott/tiger@ora10 @test.sql
EXIT

Schedule 'job.bat' file to run every 20 minutes; it will call SQL script and run it. Both will exit at the end of processing.
Re: schedule job [message #242941 is a reply to message #242113] Tue, 05 June 2007 10:06 Go to previous messageGo to next message
plshelp
Messages: 205
Registered: January 2007
Senior Member
Hi Littlefoot,

Thanks for your reply. I scheduled job.bat and it still doesn't run. It just says the scheduled task failed to start. Do I need admin rights to schedule the task?

Thank you so much!
Re: schedule job [message #243042 is a reply to message #242941] Tue, 05 June 2007 15:44 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
No, you don't ... as far as I can tell.

However, job will not run if you don't enter a correct password during the scheduling process. Did you miss that one? Or, is it a laptop that you use? Did you leave the "don't run a scheduled task if running on batteries" (something like that) checked?

Because, I have just tested scheduling this very job and it completed successfully.
Re: schedule job [message #243046 is a reply to message #242113] Tue, 05 June 2007 15:58 Go to previous messageGo to next message
plshelp
Messages: 205
Registered: January 2007
Senior Member
No. Actually my machine was on when I scheduled the job to run. So no battery issue.

Secondly, I used the same username and password like when it asks for login to startup my machine. I dont know anyother username and passwords I use for authentication for my machine.
Thatswhy I am wondering if I will need the admin rights to do this. Thanks, Littlefoot.
Re: schedule job [message #243052 is a reply to message #243046] Tue, 05 June 2007 16:30 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, if you are not an administrator, make yourself one (or ask your system administrator to enable it for you) in order to test scheduling). Won't cost much, I guess.
Re: schedule job [message #246674 is a reply to message #243046] Thu, 21 June 2007 11:08 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Did you try the exact command that Littlefoot presented? Don't use sqlplusw (notice the 'W')...use sqlplus (without the w).

Once you setup the task, right-click on it and click RUN. For troubleshooting purposes, if you want to create a log of this job running, in the RUN box of the scheduled task, just add the following:

e:\test.bat > e:\test.log

(Modify the paths above to accommodate your system & privileges)
Previous Topic: Setting up pl/sql
Next Topic: oracle net configuration assistant
Goto Forum:
  


Current Time: Thu Mar 28 16:56:05 CDT 2024