这一个显示当前“活动”的sql: –
原文链接:https://www.f2er.com/oracle/208645.htmlselect S.USERNAME,s.sid,s.osuser,t.sql_id,sql_text from v$sqltext_with_newlines t,V$SESSION s where t.address =s.sql_address and t.hash_value = s.sql_hash_value and s.status = 'ACTIVE' and s.username <> 'SYSTEM' order by s.sid,t.piece /
这显示锁。有时事情变慢了,但是因为它被阻塞等待锁:
select object_name,object_type,session_id,type,-- Type or system/user lock lmode,-- lock mode in which session holds lock request,block,ctime -- Time since current mode was granted from v$locked_object,all_objects,v$lock where v$locked_object.object_id = all_objects.object_id AND v$lock.id1 = all_objects.object_id AND v$lock.sid = v$locked_object.session_id order by session_id,ctime desc,object_name /
这是找到长操作(例如全表扫描)的好方法。如果是因为很多短的操作,什么都不会显示。
COLUMN percent FORMAT 999.99 SELECT sid,to_char(start_time,'hh24:mi:ss') stime,message,( sofar/totalwork)* 100 percent FROM v$session_longops WHERE sofar/totalwork < 1 /