Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

What does the scheduler$_event_log do

The sys.scheduler$_event_log is a table that resides in the SYSAUX tablespace.  The purpose of the scheduler$_event_log table is to store details about past scheduler events.

The scheduler$_event_log consumes an inordinate amount of space in the SYSAUX tablespace and it should be periodically truncated to keep the SYSAUX tablespace  from becoming full.  Either of these statements will purge the rows on demand:

exec DBMS_SCHEDULER.PURGE_LOG(); 

truncate table sys.scheduler$_event_log;

In addition to the conceptual job table, the scheduler uses several other tables to store metadata about scheduler objects.
select
table_name
from
user_tables
where
table_name like '%SCHEDULER$%'
and
table_name not like '%SCHEDULER$_JOB%'
;
TABLE_NAME
------------------------------
SCHEDULER$_EVENT_LOG
SCHEDULER$_WINDOW_DETAILS
SCHEDULER$_CHAIN_VARLIST
SCHEDULER$_CLASS
SCHEDULER$_GLOBAL_ATTRIBUTE
SCHEDULER$_OLDOIDS
SCHEDULER$_PROGRAM
SCHEDULER$_PROGRAM_ARGUMENT
SCHEDULER$_SCHEDULE
SCHEDULER$_WINDOW
SCHEDULER$_WINDOW_GROUP
SCHEDULER$_WINGRP_MEMBER
12 rows selected.
Under normal circumstances, one would not expect to interact with any of the scheduler tables directly. Information about the scheduler is displayed using the dba_scheduler_% views, and the dbms_scheduler package is used for the creation and manipulation of several scheduler objects including:
* Schedules - Components that define repeat intervals, allowing several jobs and windows to share a single schedule definition.
* Programs - Components that define the work done by a job, allowing multiple jobs to share a single definition.
* Jobs - Scheduled jobs that can be defined as individual entities or defined using existing schedules and programs.
* Job Classes - Logical groupings of jobs that have similar resource and administration requirements. Job classes provide a link between the scheduler and the resource manager.
* Windows - Components that define a period of time and link it to a specific resource plan, allowing the automatic control of system resources allocated to scheduled jobs.
* Window Groups - Logical grouping of windows.

This script will display details from scheduler$_event_log and scheduler$_job_run_details.

SELECT
   j.LOG_ID, 
   j.LOG_DATE, 
   e.OWNER,
DECODE(instr(e.NAME,'"'),0, e.NAME,substr(e.NAME,1,instr(e.NAME,'"')-1)),
DECODE(instr(e.NAME,'"'),0,NULL,substr(e.NAME,instr(e.NAME,'"')+1)),
e.STATUS, j.ERROR#, j.REQ_START_DATE, j.START_DATE, j.RUN_DURATION,
j.INSTANCE_ID, j.SESSION_ID, j.SLAVE_PID, j.CPU_USED,
decode(e.credential, NULL, NULL,
substr(e.credential, 1, instr(e.credential, '"')-1)),
decode(e.credential, NULL, NULL,
substr(e.credential, instr(e.credential, '"')+1,
length(e.credential) - instr(e.credential, '"'))),
decode(bitand(e.flags, 1), 0, NULL,
substr(e.destination, 1, instr(e.destination, '"')-1)),
decode(bitand(e.flags, 1), 0, e.destination,
substr(e.destination, instr(e.destination, '"')+1,
length(e.destination) - instr(e.destination, '"'))),
j.ADDITIONAL_INFO
FROM 
   scheduler$_job_run_details j, 
   scheduler$_event_log       e
WHERE j.log_id = e.log_id
AND e.type# = 66 and e.dbid is null
AND ( e.owner = SYS_CONTEXT('USERENV','CURRENT_SCHEMA')
or /* user has object privileges */
( select jo.obj# from obj$ jo, user$ ju where
DECODE(instr(e.NAME,'"'),0, e.NAME,substr(e.NAME,1,instr(e.NAME,'"')-1))
= jo.name and e.owner = ju.name and jo.owner# = ju.user#
and jo.subname is null and jo.type# = 66
) in
( select oa.obj#
from sys.objauth$ oa
where grantee# in ( select kzsrorol from x$kzsro )
)
or /* user has system privileges */
(exists ( select null from v$enabledprivs
where priv_number = -265 /* CREATE ANY JOB */
)
and e.owner!='SYS')
);

Comments

Popular posts from this blog

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

Ora2PG - Oracle/MySQL to Postgres DB migration Version 20.0

PostgreSQL Introduction