Re: Finding OEM future scheduled jobs

From: Dave Herring <gdherri_at_gmail.com>
Date: Fri, 25 Jan 2019 13:48:25 -0600
Message-ID: <CAFN=diDu=zjW8WeVQne9rL82EsBu6jbfk_FdgpZbrVKCKqTMjQ_at_mail.gmail.com>





Thank you SO MUCH Courtney!! I had blown off MGMT_JOB_EXECUTION, thinking it was only for past executions.

I had made the standard that any job that *should* be running would have a name prefixed with "(ACTIVE)", to help identify jobs that are somehow no longer scheduled yet should be. With that in mind my final cursor is:

SELECT j.job_name, j.job_owner, j.job_type, t.target_name, e.start_time   FROM mgmt_job_execution e, mgmt_job j, mgmt_job_target jt, mgmt_targets t

 WHERE e.command_type   < 3
   AND e.parent_step_id = -1
   AND e.step_type      = 7
   AND (e.job_id         = j.job_id)
   AND (    e.job_id = jt.job_id
        AND e.execution_id = jt.execution_id)
   AND (jt.target_guid = t.target_guid)
   AND e.step_name LIKE '(ACTIVE%'
   AND start_time BETWEEN TO_DATE('26-JAN-19 23:00:00') AND TO_DATE('27-JAN-19 02:00:00')
ORDER BY e.start_time DESC, t.target_name;

On Fri, Jan 25, 2019 at 1:29 PM Courtney Llamas <courtney.llamas_at_oracle.com> wrote:

> Not my query ;) But from one of the EM experts internally…
>
>
>
> A bit 'tricky'....
>
> Here's the query:
>
> SELECT j.job_id, j.job_name, j.job_owner, j.job_type, e.start_time
> FROM mgmt_job_execution e, mgmt_job j
> WHERE e.start_time > mgmt_global.sysdate_utc
> AND e.command_type < 3
> AND e.parent_step_id = -1
> AND e.step_type = 7
> AND e.job_id = j.job_id
> ORDER BY e.start_time DESC
> ;
>
> One 'but' here:
> - This output WILL include a set of jobs that the 'system' has scheduled
> on behalf of the users (and the admin tasks those users did)
> Those jobs are not going to be a problem: If the OMS is down at the time
> the job was supposed to start, they'll just wake up when the OMS's come
> back online, and kick off
> - If the EM users of the site have been 'good', and NOBODY is using SYSMAN
> to do stuff, you COULD filter out those jobs like this:
> AND j.job_owner != 'SYSMAN'
>
> That would give you JUST the user-submitted jobs in the system that are
> 'waiting for their start time'....
>
>
>
>
>
> --
> - Courtney
>
> [image: Oracle] <http://www.oracle.com/>
> Courtney Llamas | Architect
> Phone: +17137342102 | Mobile: +18324720596
> https://myoracle.webex.com/meet/courtney.llamas
> Oracle Security & Systems Management
>
> [image: Green Oracle] <http://www.oracle.com/commitment>
>
> Oracle is committed to developing practices and products that help protect
> the environment
>
>
>
> *From:* Dave Herring <gdherri_at_gmail.com>
> *Sent:* Friday, January 25, 2019 11:08 AM
> *To:* ORACLE-L <oracle-l_at_freelists.org>
> *Subject:* Finding OEM future scheduled jobs
>
>
>
> Folks,
>
>
>
> We have downtime scheduled for 2 of our 12c OEMs (12.1.0.4 OMS) Saturday
> night starting at 11pm. I know some OEM job executions will occur within
> the window and also know that once the OMS is back up it'll immediately
> schedule single executions that were missed, but what I currently don't
> have is a way to programmatically determine ALL executions that will be
> missed within the downtime.
>
>
>
> Within the Console in Job Activity you can see the next scheduled
> execution for all jobs, but if a job is scheduled every Tues and Sat and
> it's currently Monday, for example, you don't see that the Sat execution
> will happen because, obviously, it's not scheduled yet. Same with
> "get_jobs" option of "emcli". What I'd like to do is run a cursor that
> determines for a given time window what all job executions should happen.
> I know that I can use FREQUENCY_CODE and INTERVAL off of MGMT_JOB_SCHEDULE
> to calculate future executions, but I was wondering if anyone has already
> written this logic and would be willing to share. Or maybe I missed
> something and this kind of functionality already exists.
>
>
>
> After writing the above it sounds like I'm being lazy but, well, I am.
> I'm mainly hoping to not re-invent something if I don't have to. I did a
> few searches but as always, I didn't find a lot written about OEM jobs.
>
>
>
> Thx.
>
>
> --
>
> Dave
>

-- 
Dave





-- http://www.freelists.org/webpage/oracle-l

image001.gif
(image/gif attachment: image001.gif)

image002.gif
(image/gif attachment: image002.gif)

Received on Fri Jan 25 2019 - 20:48:25 CET

Original text of this message