How to find the last trigger fired, package execution time and the counts?
426850Jul 27 2007 — edited Aug 5 2007Is there a way to find when and how much an Oracle object was accessed through v$ or x$ objects? Examples may be -
- when a package was last executed and how many times,
- when a job(I mean dbms_job:) ...
- when a sequence ...
- when a trigger ...
etc.
I know we can implement application level solutions for these needs, but I am after something internally already implemented :)
For example the following script was adapted from the research of Mr.Steve Adams (www.ixora.com.au) -
sys@PO8IR3:SQL>@v8_running_sqls
**** Currently Executing Packages ****
no rows selected
sys@PO8IR3:SQL>get v8_running_sqls
1 prompt **** Currently Executing Packages ****
2 SELECT
3 substr(DECODE(o.kglobtyp,
4 7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE', 12, 'TRIGGER', 13,
5 'CLASS'),1,15) "TYPE",
6 substr(o.kglnaown,1,30) "OWNER",
7 substr(o.kglnaobj,1,30) "NAME",
8 s.indx "SID",
9 s.ksuseser "SERIAL"
10 FROM
11 sys.X$KGLOB o,
12 sys.X$KGLPN p,
13 sys.X$KSUSE s
14 WHERE
15 o.inst_id = USERENV('Instance') AND
16 p.inst_id = USERENV('Instance') AND
17 s.inst_id = USERENV('Instance') AND
18 o.kglhdpmd = 2 AND
19 o.kglobtyp IN (7, 8, 9, 12, 13) AND
20 p.kglpnhdl = o.kglhdadr AND
21 s.addr = p.kglpnses
22* ORDER BY 1, 2, 3
Best regards,
Tonguc