PLSQL program should run on any day between 1 and 5 of every month and between 25 and last day month - oracle

I have a PLSQL program with three cursors. This program should run as a job.
The job should run on any day between 1st and 5th of every month. And also between 25th and last day of every month. How to write a logic to run this program?

I would set a database job to run every day and then make a simple if clause at the start of the program to check if it's valid day to run the rest of the code.

Check out the DBMS_SCHEDULER routines.
The new version (v3) of Oracle's SQL Developer has a nice GUI for setting up schedules

Related

How to make scheduler which will run process only at working days?

I'm working with Informatica(ETL). I want that scheduler run processes only at working days (it's not always from Monday till Friday).
For example, we have not working days from 31-DEC-2020 till 10-JAN-2021. Or 20-FEB-2021 is working day but 22-FEB-2021 AND 23-FEB-2021 are holidays.
I can generate file with not working days or only working days. Can informatica scheduler read this file(or smt else) to run processes only at working days? Any ideas how to solve this problem?
Now I have on Oracle db table with working and not working days.
Easiest would be
create a session which will read form work-day file/table and compare with sysdate. And produce 1 row if match found else 0.
Then other sessions after first one - if previous row output is =1 then proceed else dont do anything.
So basically first session will ensure if its a workday, session will proceed else it will stop.

Add cron entry to XAMPP server

I am using Laravel 5.4 on Windows. In the documentation, it does not say how to add cron entries to server. I searched on YouTube, but didn't get any useful video. I need to learn how to add cron entries both to localhost and cPanel.
First of all you can add cron only in Server Not for localhost
To add cron in cPanel follow the steps below
Step1:-
First create a cron function to which the server is going to hit,
and get the Full path like
http://fullpath
Step2:-
Then got to cron jobs in cpanel and set the time when the cron will hit that route.
To set the time you have to follow this
Minutes represents the minutes of a given hour, 0-59 respectively.
Hours represents the hours of a given day, 0-23 respectively.
Days represents the days of a given month, 1-31 respectively.
Months represents the months of a given year, 1-12 respectively.
Day of the Week represents the day of the week, Sunday through Saturday, numerically, as 0-6 respectively.
Like this
Step3:-
Then Write the cron comand like
curl http://fullpath
Like this:-
This above cron job is set for 1 sec.That means the cron will hit that route in every one sec.
Like this you can set your cron on cPanel.

Scheduling Monthly job using oozie coordinator

Can you please help me with, what can be used to for scheduling an oozie coordinator job to execute on first Monday of every month.
I know we have a frequency parameter that can be set as ${coord:months(1)} . But this will not allow me to schedule the jobs on a particular day of a particular week of a month. Hope I am not complicating the question here.
Any help is strongly appreciated.
Thanks,
Syed
You unfortunately cannot schedule in the specific manner you are looking for. As you already note, you can run on a monthly basis - i.e. the 5th day of each month, but you are not be able to control the Day of the Week other than for the first materialization.
A possible work around this would be to run your coordinator on a weekly basis, to materialize on the Monday and then have a custom Java Action as your first step in the workflow that will throw an exception if it's not the first day of the month.
A downside of this approach is that you'll see 4 or so failures per month in the job list for the coordinator, but at least it will give you the behaviour you're looking for.

DBMS_JOB usage: 'Singular' job keeps recurring every five seconds

I learned (the hard way) that DDL statements cannot be executed in the non-transactional context of a logon trigger, and that the solution is a job. I want the job to be executed immediately and one single time and therefore set the next_date parameter to sysdate and the interval parameter to null.
Here is what I execute in the trigger:
dbms_job.submit(
job=>jobNumber,
what=>'someProcedure(someParameter);',
next_date=>sysdate,
interval=>null
);
This works quite good, but once the trigger has been fired (and the above command has been submitted) for the time, the audit log shows that the job keeps reappearing exactly every five seconds under the same user account it has been submitted under for the first time. The associated program is always something like ORACLE.EXE (J001), although it was of course a user session initiated from a client application.
Can anyone explain this to me please? I hoped to get a singular execution of the job and not an eternal recurrence. Thanks in advance!

Oracle Scheduler - can a single job be both event based and time based

Hi I am new to Oracle Scheduler. My question is - Can we give both repeat interval and event condition in the Schedule object for a single job?
I have this requirement in job scheduling - A job should run at a scheduled time, but only if a certain event has occured.
For eg.
Job1 should run
- at 10 am every day
- but only if same job from yesterday is not running anymore. (This I gonna figure out based on the table entry.) So the event gonna be a cell entry say 'ENDED' in the table job_statuses.
Would be easier if I can give both info in the same job. Else another approach I gonna try is - Schedule the job based on time. If the earlier instance is still running , reschedule the job based on event. But this looks clumsy.
Thanks in advance.
Mayank
I'd encode the condition in the PL/SQL of the procedure itself. i.e. it runs at 10am every day, but the first thing it does is check if the previous job had finished successfully.
What you could do is create 3 jobs
EVENT_JOB
REPEAT_JOB
ACTUAL_WORK_JOB
EVENT_JOB and REPEAT_JOB just start ACTUAL_WORK_JOB. If that is already - or still - running, you get an error on which you can react accordingly.

Resources