getting informations about processes [message #677326] |
Thu, 12 September 2019 05:52  |
 |
limner1977
Messages: 6 Registered: September 2019
|
Junior Member |
|
|
Hi
i'm writing a stored procedure that write logs into an oracle table about the procedure that calls it.
this monititoring procedure, using OWA_UTIL.who_called_me retrieve the name and the owner of the procedure to log info.
Now i need to store the starting time of the procedure that called the monitoring procedure.
I would not like to use a variable to store sysdate at the beginning, instead i would like to know it there is a way inside oracle to find then a stored procedure, package, function or anonymous block has been launched.
this is the example
ad anonymous block call, as last instruction before commit, my monitoring procedure.
the monitoring procedure write info in a logging table, with also start and end time
end time is gotten using sysdate inside monitoring procedure...but how could i retrieve "starting time" ?
thanks
Limner
|
|
|
|
|
Re: getting informations about processes [message #677348 is a reply to message #677332] |
Fri, 13 September 2019 01:09   |
 |
limner1977
Messages: 6 Registered: September 2019
|
Junior Member |
|
|
hi
There is no need of code example because there is no debug to do: i was trying to understand if something can be achieved or not.
Of course, if i inizialize a variable to sysdate as first instruction of a procedure and, at the end i give it to another procedure that make insert in a table, i have the starting time and also ending time of a procedure.
What i was trying to do was to avoid to initialize a variable and do everything from the last istruction that is a calling to the "monitoring procedure"
i write an example here
declare
bla bla bla
begin
first istruction
second istruction
.
.
.
monitoring_procedure(variable)
commit;
exception
when others then
bla bla bla
end;
the monitoring_procedure would write in a log table info as starting and ending time of procedure that called the it.
i was simply trying to avoid to put another instruction, as first, that was the initialiting variable to sysdate to get the starting time and pass it to the monitoring procedure.
that was the question: using OWA_UTIL.who_called_me i was able to get some usefull informations, like the name and type of procedure that called the monitoring procedure and i was trying to understand if Oracle, togheter with the type of procedure, also store the starting time of that procedure.
Sorry for my english, i hope that this is more understandable.
Danilo
[Updated on: Fri, 13 September 2019 03:57] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: getting informations about processes [message #677401 is a reply to message #677394] |
Tue, 17 September 2019 06:33   |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
don't use the owa_utility package the dbms_utility package does a much better job. who_called_me shows the latest line. The format_call_stack and format_error_stack from the DBMS_UTILITY shows the entire path of execution.
The following query will give the time that the session connected
SELECT Logon_time
FROM V$session
WHERE Audsid = SYS_CONTEXT ('USERENV', 'sessionid');
|
|
|
|