查询执行系统用户在当前数据库执行的sql操作
select t.SQL_ADDRESS,
t.SQL_HASH_VALUE,where t.OSUSER = 'dev';
如果有sql_id则可以直接在v$sqltext中查询,不过有时候没有SQL_ID ,但是有PREV_SQL_ADDR,因此利用sql address的值查询
select * from v$sqltext where address='00000000B2F51480';
然后根据业务要求,查看最近SQL执行信息
select sql_text,
sql_id,
first_load_time,
t.LAST_ACTIVE_TIME,
t.USER_IO_WAIT_TIME,
t.PARSING_SCHEMA_NAME,
t.MODULE,t.ACTION
from v$sqlarea t
where sql_text like '%TC_WHITE_LIST%' and t.MODULE='cmps.bin@ubuntu (TNS V1-V3)';
查看指定session 的资源消耗情况
select b.sid,a.name,b.value
,s.module
from v$sesstat b ,v$statname a ,v$session s
where a.STATISTIC# =b.STATISTIC#
and s.sid = b.sid
and s.SID=36
and s.OSUSER='dev'
and a.NAME in('consistent gets','physical reads','parse count (total)','parse count (hard)')
order by b.sid asc,a.name asc;