to find queries ran from a particular user in last 1 month oracle database

select tab.*,t.sql_text from (select trunc(b.begin_interval_time) DateRun,a.PARSING_SCHEMA_NAME,
a.Sql_id,a.plan_hash_value PLANHASH,sum(a.executions_delta) executions,max(px_servers_execs_delta) PXUsed,
sum(a.disk_reads_delta) disk_reads,sum(a.buffer_gets_delta) buffer_gets,sum(a.rows_processed_delta) rows_proced,
sum(a.elapsed_time_delta)/(1000000*60) ELAPSEDTIME_mIN,
sum(a.elapsed_time_delta)/(1000000*60*decode(sum(a.executions_delta),0,1,sum(a.executions_delta))) Per_EXEC_MINS
from DBA_HIST_SQLstat a, dba_hist_snapshot b
where a.PARSING_SCHEMA_NAME='<schema_name>' and
a.snap_id = b.snap_id and trunc(b.begin_interval_time)> trunc(sysdate-30)
group by trunc(b.begin_interval_time),a.PARSING_SCHEMA_NAME,
a.Sql_id,a.plan_hash_value order by trunc(b.begin_interval_time) desc) tab, dba_hist_sqltext t
where tab.sql_id=t.sql_id;

Comments

Popular posts from this blog

Installing DBMS_JAVA package in Oracle and calling UTL_DBWS web services through Oracle database

Starting background process GTX4 and GLOBAL_TXN_PROCESSES

stick the job to the specific instance in Oracle RAC