Schedule A Job To Run Upon Completion of The Currently Running Query
Hi friends,
Sometime right after sometime a query starts I realize the same to be taking quite a long time and then upon realizing that I hadn't selected the next portion of the T-SQL which depends upon the result of the ongoing query I have to wait for hours to launch
the same after completion of the first part. In such a case could there be a way to somehow assign SQL Server Agent a Job to check the status of the ongoing query at some intervals of 10-15 minutes,
or preferably some other way, to trigger the job of carrying out the pending job automatically upon completion of the ongoing query?
Thanx in advance, Best Regards, Faraz A Qureshi
Something like:
if exists(
select * from sys.dm_exec_sessions s
inner join sys.dm_exec_requests r
on s.session_id = r.session_id
where r.session_id = ??
and s.program_name like 'Microsoft SQL Server Management Studio%'
and s.login_name = 'MyLoginName'
and r.status = 'sleeping'
Satish Kartan www.sqlfood.com
Similar Messages
-
How to schedule a job to run twice within a request set?
How to schedule a job to run twice within a request set?
Create one more stage for the same concurrent program.
Thanks
Nagamohan -
How to schedule a job to run only in a time window
Hi,
I need to schedule a job to run every day but sundays from 7am to 6pm. I managed to get it to start at seven like this
FREQ=WEEKLY;BYDAY=TUE,WED,THU,FRI,SAT;BYHOUR=7;BYMINUTE=0;BYSECOND=0
how can I set the job to stop at 6pm?
thanks in advanceYes, as far as I could tell you create a resource plan to allocate processor resources, assign a resource plan to the window, then assign the job to a job class which is in turn assigned a resource group within that resource plan. Then when the window is active, it sets the active resource plan for the database so the job will run using this until the window deacivates the resource plan. Unfortunately because the resource plan is database wide, it means you could only really have one time window active at any one time within which to run jobs, I don't think two windows could overlap.
Easier to work within jobs, but its a shame the job doesn't end itself, rather than having to have the second job, although the second job does enable you to engage in some communication between jobs to cleanly end it, rather than stop it dead. I have a job that runs until a set time each day, but it just works on a loop that sleeps for a few minutes each time, checking for file arrival and processing it, and sending a notification e-mail if it reaches its end time without the file arriving. -
How to schedule ETL jobs to run periodically after BI Apps is up and runnin
Hi,
How do you schedule ETL jobs to run periodically after BI Apps is install and configured? Is there document out there that explains how the ETL scheduling is setup?
ThanksUsing DAC we can schedule the ETL to run periodically. In DAC Execute -> Scheduler you can set the date and time for the ETL which need to be scheduled. You can get detail information in guide 'Oracle® Business Intelligence Data Warehouse Administration Console User’s Guide'
-
Schedule multiple jobs/test runs
Hi,
Is there a way to schedule multiple jobs/test runs with oats 9.10?
It seems it is only possible to schedule a single job, by setting the start time in OLT...
Any suggestions?Hi
I'm talking about functional tests.
In OLT when you set the auto-pilot you can schedule the test to start after a delay of xxx minutes or at some exact time, however I have never used that fixture.
Regards
Alex -
How to schedule batch jobs to run after another periodically?
Hi good people,
I want to schedule batch jobs to run periodically one after another.
Here is the problem:
I have scheduled JOB1 to run once a week and I scheduled JOB2 to run after that job (JOB1). The problem is that JOB2 runs only after the first time that JOB1 runs. The second time the JOB1 runs the JOB2 is not started. I presume that the reason for that is that JOB2 is tied to the job number for the JOB1, and since a new job (with the new number) is created every week, the JOB2 is only tied to the first instance of JOB1.
So does anyone have an idea how to get JOB2 to automatically run every week after JOB1? One idea is to use events, but that I'm hoping that there is a bit cleaner solution..
Best Regards,
ArminHi
Try scheduling both JOB1 & JOB2 in a single job in steps.
First schedule JOB1 & then give JOB2 in steps.
Kindly check the following link to do job scheduling in steps:
http://help.sap.com/saphelp_47x200/helpdata/en/c4/3a7ed1505211d189550000e829fbbd/frameset.htm
In the above help documentation, look for the topic <b>"job steps"</b> in
"Background Processing: Concepts and Features"
hope it helps!
best regards,
Thangesh -
How to schedule a job to run after completion of each run using DBMS_JOB ?
Hi Gurus,
Please let me know if the subject requirement can be fulfilled. I want to schedule a job using DBMS_JOB to run a script sequentially after completion of each run.
Thanks in advance.
SantoshHi Santosh
Instead to use the old dbms_job package use the dbms_scheduler and raise / catch events.
Oracle create dbms_scheduler also for this purpose you need.
You can find tons of examples on the web.
Aurelio -
HELP scheduling a job to run within a window
Hi,
I am trying to create a job that can only run at certain times of the day. Since I will be creating a lot of these jobs (each of which will run once), I thought I could use a window to define when this job runs. As a test, I tried the following:
begin
dbms_scheduler.create_window(
window_name => 'TEST_WINDOW',
resource_plan => null,
repeat_interval => 'FREQ=DAILY',
duration => INTERVAL '24' hour,
window_priority => 'LOW'
dbms_scheduler.create_job(
job_name => 'TEST_WINDOW_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN NULL; END;',
schedule_name => 'SYS.TEST_WINDOW',
enabled => true );
end;
/But this doesn't work as expected.
1) all_scheduler_windows shows that TEST_WINDOW is not ACTIVE. However, if I try to explicitly open the window with DBMS_SCHEDULER.OPEN_WINDOW, I get an error saying the window is currently open.
2) The job is created, but its STATE is set to SCHEDULED and it doesn't run even though the window is open and the job is enabled. (I also tried creating a job using a window that was ACTIVE in all_scheduler_windows and got the same results).
Can anyone point out what I am doing wrong here?
Thank you,
EricHi Eric,
Two things.
1) You can have a schedule which repeats once an hour (or even once a minute) from 8pm till 7am and then point all your jobs to this schedule. You will need to set max_runs for the jobs to 1 before enabling them. So they will only run on the given schedule and only once. A possible repeat interval for the schedule is :
freq=minutely;bysecond=0;byhour=20,21,22,23,0,1,2,3,4,5,6,7;byday=MON,TUE,WED,THU,FRI
2) By default, the database comes with several pre-created windows and a MAINTENANCE_WINDOW_GROUP . This window group is supposed to be user-modified to periods where it is ok to do maintenance tasks. You may be able to point your jobs to this window group or one of its windows, if you want your jobs to run during this period.
Hope this helps,
Ravi. -
HOW TO SCHEDULE A JOB TO RUN EVERY 30 MINS WITHOUT USING SCHEDULAR?
Hi,
I have a requirement where i need to schedule the job to run every 30 mins for 10 am to 10 pm. I ran into problems using odi schedular. Let me tell you what i did..
i have chosen the active mode between 10 am to 10 pm
selected on startup/simple.
and on the repetitions tab selected many times with 30 mins duration.
the problem was-----
a)it was not stopping at 10 pm but continues after 10 pm
b)randomly picking up more times than the 1/2 hour duration.
looking for---
a solution that runs my scenario every 30 mins from 10 am to 10 pm without using the schedular...which i cannot trust.
Regards
VenkatVenkat,
Here is an alternate solution that i can think of:
create a package with the following components:
Variable(Refresh) -> OK -> Execute StartScen(YourJob) in Asynchronous mode -> odiSleep(30 mins) -> Loop to Variable Refresh
Variable (Refresh) -> KO -> odiSleep(30 mins) {if the refresh of the variable fails to get any value then skip the Job execution}
The Refresh query should be
select 1 from dual where to_char(sysdate, 'hh24mi') between '1000' and '2200' -
How to: Schedule a job to run on the first business day of the month
In Oracle 10.2.0.3, is there a way to schedule a repeating job to run on the first business day of the month? For example, if the first of the month falls on a weekend (such as Saturday, 11/01/2008), I would like the job to run automatically on Monday (for example, 11/03/2008) instead.
set serveroutput on
begin
print_dates('FREQ=MONTHLY;BYDAY=MON,TUE,WED,THU,FRI;BYSETPOS=1;',
to_timestamp_tz('01-JAN-2008 12:00:00','DD-MON-YYYY HH24:MI:SS'), 12);
end;
Gives:
TUE 01-JAN-2008 (001-01) 12:00:00 -07:00 -07:00
FRI 01-FEB-2008 (032-05) 12:00:00 -07:00 -07:00
MON 03-MAR-2008 (063-10) 12:00:00 -07:00 -07:00
TUE 01-APR-2008 (092-14) 12:00:00 -07:00 -07:00
THU 01-MAY-2008 (122-18) 12:00:00 -07:00 -07:00
MON 02-JUN-2008 (154-23) 12:00:00 -07:00 -07:00
TUE 01-JUL-2008 (183-27) 12:00:00 -07:00 -07:00
FRI 01-AUG-2008 (214-31) 12:00:00 -07:00 -07:00
MON 01-SEP-2008 (245-36) 12:00:00 -07:00 -07:00
WED 01-OCT-2008 (275-40) 12:00:00 -07:00 -07:00
MON 03-NOV-2008 (308-45) 12:00:00 -07:00 -07:00
MON 01-DEC-2008 (336-49) 12:00:00 -07:00 -07:00
and the print_dates function is (10.2):
create or replace procedure print_dates
cal_string in varchar2,
start_date in timestamp with time zone,
nr_of_dates in pls_integer
is
date_after timestamp with time zone := start_date - interval '1' second;
next_execution_date timestamp with time zone;
begin
dbms_output.put_line(' -->');
for i in 1 .. nr_of_dates
loop
dbms_scheduler.evaluate_calendar_string
(cal_string, start_date, date_after, next_execution_date);
dbms_output.put_line(to_char(next_execution_date,
'DY DD-MON-YYYY (DDD-IW) HH24:MI:SS TZD TZH TZR'));
date_after := next_execution_date;
end loop;
end;
[\pre] -
Easy way to schedule a job to run for a set period?
Is there an easy way to schedule (dbms_scheduler) a job to run for a set period -say, half an hour- and then to stop.
Currently, I schedule a procedure to do the work (a bunch of inserts or updates, say) and the first line of that procedure assigns sysdate to a variable when it starts. Then as the procedure loops through its work, I compare the current sysdate with that original one, and if the new sysdate>original one by more than 30 minutes, I raise an application error. But it's messy, and I was wondering if there was a nicer way of doing it?"Admin" -I think you'll find that 'end_time' merely states a time after which the job will not be run. It doesn't do anything to kill off a job which is already running at the time that comes round. Similarly, repeat_interval merely states how often the job should be run, not a time interval within which it must run and outside of which it must stop being run.
Satish: your suggestion looks great. Do you have, or know of, any examples where that is used, though? The doco you pointed to says the parameter raises an event, but that it's up to my event handler to deal with it. I wouldn't have the first idea of how to deal with this in code myself. If I could see a simple example, it would help a lot! Unfortunately, that page doesn't contain such an example! -
Schedule background jobs which run only on Thursdays.
Dear Friends,
We are using ECC6.00. I have a requirement whereby a specific job (background) should be executed only on Thursdays. I searched in this forum but couldn't get anything related to my question. I tried the options present in the SM36 transactions (scheduling options).
Is there any way of achieving my requirement.? Experts help required.
Regards,
M.MHi Magesh,
I am not sure if this would be the right approach. But if you are really sure that there is no way to do this using SM36 settings,
you can schedule a job to execute daily, which would be a custom abap program.
This program would check the day and if it is a thursday ,will schedule another job for the day(programatically).
This can be a way around to solve this problem.
Regards,
Sagar -
Schedule a Job that runs every week at 6:00am
Hi Guys,
How do I schedule a job to be executed once every week at 6:00am using the DBMS_JOB package.
Cheers
Message was edited by:
s9968021Check the documentation for more details.
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_job.htm#ARPLS019
Example:
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'dbms_output.put_line(''processing a lot of things'');'
,next_date => to_date('24/12/2006 06:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'TRUNC(SYSDATE+7)'
,no_parse => TRUE
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
END;
commit; -
We have a job group i.e. Job Group A that creates a second instance of the job group Job Group A (2) and completes normally. The problem is we have another job group that is dependent on Job Group A (1) so it never runs until we cancel the first job group or set it as completed. What could be inserting the Second occurrence of the JOB Group?
This sounds like a repeating job/group with new occurrences. Check out the Options tab for both group and job-levels
Group Options, If job is running, then Run Anyway
Job Options, If job is running, then Run Anyway
The correct setting should be:
Group Options, If job is running, then Run Anyway
Job Options, If job is running, then Defer until Normal or Defer Until Complete
which means if any of the deferred options are selected, the second occurrence will wait until job is completed normally (Defer Until Normal), or wait until job either completes normally or abnormally (Defer Until Complete)
Now I wonder what causes the second instance to complete normally and not the first instance.
BR,
Derrick Au -
How to schedule a job to trigger SAP IE send the message
Hi XIer,
Our scenario:
I created a report to use ABAP client proxy to trigger a message in SAP R3. I can see this message has generated in SXMB_MONI in SAP IE(not in XI IE),but the message status is <message released( commit successful )>, but not send, so I go to SMQ2 inbound queue, and execute the message which pending there waiting for trigger. Then the message successful send out.
My question will be: I believe there will be some background job to do this job to trigger the messages lay in the inbound queue, but I don't know which report will do this job, is there any one can give some hits? thank you very much for your time. : )Hi -
Have you registered the queues on the R/3 side? In SAP R/3's SXMB_ADM-->Manage Queues, then select "Register Queues" and "Execute Action" button.
Shouldn't need to schedule a job to trigger the send.
Regards,
Jin
Maybe you are looking for
-
We have a sales tool that we have created for one of our clients in iBooks Author. They need the iBook creating in various languages. We need to be able to supply the multiple versions of the same document (in the different languages) to our client a
-
HR PNP LDB and authority check
Hello All, Can someone plzz tell me if there is any major difference between CODE1 and CODE2 below? I understand if we use LDB we dont need to do authority check but is there is any exceptional case where we do this kind of codeing... C
-
Issues in setting up demo data for MapViewer 10.1.3.1
Hi, I downloaded the MapViewer Quick Start Kit from http://www.oracle.com/technology/software/products/mapviewer/index.html I also downloaded the Demo Data set. I started the OC4J instance and able to view the MapViewer admin page. I created the mvde
-
Is it necessary to keep brick attached to plug when charging ipad 3 or can I just plug in the detachable part? If so, why does it come with a big brick?
-
How to resize the Director stage
I need my programme to adjust the size of the Director stage to one of 3 dimensions at startup 1024x768, 768x432 or 1280x720 acording to a variable it reads in from a ini file. How can this best be achieved within a single Director movie (I don't wan