capture start of query submited by user SQL_ADDRESS in V$session
I am trying to capture the estimated COST and estimated completion time for a query submitted by a user. See query below. I get results back from this only when a query is running. I need to capture somehow the start of a query submitted by an user.
IN V$SESSION there is a field that gets assigned a Hex address during the time the query is running. SQL_ADDRESS after the query completes this is set to 00. How can I capture the value of this field? when users submit a query? Is there an event trigger I could use?
ANY help will be appreciated.
10 v$SQL_PLAN_STATISTICS_ALL a, v$session b
12 a.address = b.sql_address and
13 a.id = 1 and a.cost is not null and starts > 0