Home » RDBMS Server » Performance Tuning » executions (10.2.0.4, Windows 2003)
executions [message #528571] Tue, 25 October 2011 13:00 Go to next message
sant_new
Messages: 165
Registered: June 2008
Senior Member
Hi Friends,

I need to know how many number of times the sql's had been executed/run in an oracle session. Executions in V$sql, is it the right place to look at? Will it give the number of times the sql has been executed in a particular session?

Thanks again

Re: executions [message #528572 is a reply to message #528571] Tue, 25 October 2011 13:04 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
SQL is SHARED across all sessions in the DB.
In other words what is returned from V$SQL, will be from 1 or more sessions.

AUDIT can provide desired level of detail
Re: executions [message #528573 is a reply to message #528572] Tue, 25 October 2011 13:07 Go to previous messageGo to next message
sant_new
Messages: 165
Registered: June 2008
Senior Member
Okay. But right now there are no other sessions connected to this database.. so it should all be from this one session that I'm trying to get the sql executions for...

I tried this to get the number of times a sql has been executed, but I'm not sure if this is really right...

select c.user_name, c.sid, sql.sql_text, sql.executions
from v$open_cursor c, v$sql sql
where c.sql_id=sql.sql_id
and c.sid=151
order by executions desc

Please help... Thanks
Re: executions [message #528574 is a reply to message #528573] Tue, 25 October 2011 13:16 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/

valid SQL
  1  select c.user_name, c.sid, sql.sql_text, sql.executions
  2  from v$open_cursor c, v$sql sql
  3  where c.sql_id=sql.sql_id
  4  and c.sid=151
  5* order by executions desc
SQL> /

no rows selected

Previous Topic: Tracing long running program
Next Topic: Performance Tuning
Goto Forum:
  


Current Time: Thu Mar 28 16:27:26 CDT 2024