I have a job that i want to run on demand. I create the job with disabled status.
job_name => 'myjob"',
job_type => 'PLSQL_BLOCK',
job_action => 'DECLARE
job_class => 'DEFAULT_JOB_CLASS',
comments => 'desc',
auto_drop => FALSE,
enabled => FALSE);
sys.dbms_scheduler.set_attribute( name => 'myjob', attribute => 'job_weight', value => 4);
sys.dbms_scheduler.set_attribute( name => 'myjob', attribute => 'restartable', value => TRUE);
I call dbms_scheduler.run_job('myjob') when i have to run the job. It runs the job and does my action. But if i query
select * from user_scheduler_jobs;
last_start_date and last_run_duration column values are null. I want to know how long my job runs to perform the action. Any idea?
Check the documentation for dbms_scheduler.run_job . There are 2 types of run_job depending on whether use_current_session is true or not.
Foreground jobs (use_current_session=> true) do not update job stats. Only background job runs (use_current_session=>false) do.
Thanks Ravi. Using USE_CURRENT_SESSION => FALSE updated the job status. But doing this will the second job wait for first job to finish? I don't want more than one job to run simultaneously. Second job need to wait for first job to finish and then start.
Couldn't you have a single job which runs every hour
In the job at the beginning, check whether it is time to run to the full backup, and if so then do that otherwise run the normal backup.
A job never has multiple instances running at the same time so you would never have 2 backups running at the same time.
Hello Ravi thanks for the reply..
Can i know what condition can i use to check which job should run?
I actually did not get exact meaning u said..can i have an example for a job that should check the time and run..
thanks a lot for assisting..
If you want the full backup to run at 1am every Friday but the normal backup to run all other times, then you could do something like this
If day=friday and time<2am and time>=1am then
do full backup
do normal backup
Then you could run this action once every hour.
Unfortunately I can't give you the exact syntax but it should not be hard to figure out.
these two backup job are shell scripts so am thinking shall i create one more shell script with the condition u mentioned (if day = firday and time=1am ...)
there by calling these two backups shell scripts / just simply create plsql code and assign it to a job?
Edited by: 957944 on Sep 13, 2012 1:48 PM