|
Raj,
You must be speaking from “UNIX heights” -J Under Windows I find dbms_job much more reliable than windows “at” scheduling. Actually, never had problems with dbms_job “forgetting” to run a job.
Igor Neyman, OCP DBA [EMAIL PROTECTED]
-----Original Message-----
Garry, 1. have you tried select to_char(sysdate,'D') from dual ?? This is really nice, but my only gripe with dbms-job is that is isn't reliable ... it wasn't in 9ir1 on aix and we didn't even look at it in 9ir2. in 9ir1 dbms_job used to _forget_ to run jobs after some time and the workaround was like setting job_processes to a very large number. nevertheless, I think what you have attempted is fantastic and worthy of adoption ... Raj
-----Original Message-----
Any Interest? The DBMS_JOB package is supplied by Oracle to allow the running of procedures at regular intervals. Unfortunately the INTERVAL parameter is limited to 128 characters, which prevents you from getting very complex (user defined functions [in the interval parameter] do not work well - according to Fuerstein in his book Oracle Built In Packages). The situation is eased somewhat by the fact that the NEXT_DATE parameter can be supplied to the procedure as an in/out parameter - and the procedure can contain whatever code is necessary to calculate when next to run. This is all very well, but custom coding scheduling routines can quickly become tedious. On the basis of "do it once and get it over with" I have written a function called NEXT_DATE which I have wrapped in a package called CRON. There is a Unix program called cron which runs jobs on a regular basis. Although the scheduling data supplied to cron is simple and concise, complex schedules are easy to specify. The NEXT_DATE function takes in a cron schedule string and returns the next date that conforms to the schedule - or you can supply a cron schedule and a date and it will return the first date after the supplied date that conforms to the schedule. At the moment it is not very friendly on the error detection front. A VALUE_ERROR is returned if it deems the cron schedule to be invalid. You will also get a VALUE_ERROR if the next valid date is more than twenty seven years in the future. DBMS_OUTPUT is used to display error messages which will hopefully give you a clue. This will be improved if I receive enough complaints ( and suggestions for improvements). THE CRON SCHEDULE A cron schedule consists of five components, each
separated from the next by a space. I have chosen to go with ISO standard 8601:1998 which runs from 1-7 with 1 being Monday. This is so close to the Unix convention that I can interpret Unix cron schedules correctly. Curiously, Oracle do not provide a date format which supplies this number. The ISO week number is available with the format 'IW', but not the ISO day number. If you have a field of type date called dt, you can obtain the ISO day number with ( trunc(dt) - trunc(dt ,'IW') ) + 1 A component can consist of an asterisk * which represents all valid values or a number of elements separated by a comma (if only one element is supplied, forget the comma). An element can be a single number - valid for the component (32 in "Day in month" is invalid) or two numbers separated by a hyphen - which represents a range. EXAMPLES Run every hour on the hour Garry Gillies |
Title: RE: DBMS_JOB scheduling
- DBMS_JOB scheduling Garry Gillies
- RE: DBMS_JOB scheduling Jamadagni, Rajendra
- RE: DBMS_JOB scheduling Igor Neyman
- RE: DBMS_JOB scheduling Garry Gillies
- RE: DBMS_JOB scheduling Jamadagni, Rajendra
- RE: DBMS_JOB scheduling Jamadagni, Rajendra
