标签:order man text ssi info mac name sql_id rom
----查询当前数据库堵塞SQL
select count(*),sql_id,min(sql_exec_start),sql_child_number from v$session where status=‘ACTIVE‘ group by sql_id,sql_child_number order by 1,3;
---根据SQL_ID 查询堵塞SQL 内容
select * from v$sql where sql_id=‘cct9z95t5ssga‘;
---查询根据SQL 内容查询绑定变量
SELECT b.name, b.position, b.datatype_string, b.value_string
FROM v$sql_bind_capture b, v$sqlarea a
WHERE b.hash_value = a.hash_value
AND b.sql_id = a.sql_id
and a.sql_id = ‘cct9z95t5ssga‘;
-----根据完整SQL 查询执行计划;或者直接根据SQL_ID 查询执行计划
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(‘&1‘,&2, ‘ADVANCED -PROJECTION‘));---第一个变量是SQL_ID
---根据SQL_ID 查询SQL 对应的 主机、IP 地址等信息
select a.USERNAME,a.SCHEMANAME,a.MACHINE,a.PROGRAM,a.MODULE,a.CLIENT_INFO from v$session a where a.sql_id=‘&1‘
----如果SQL 内容在 v$sql 、v$sqlarea 已经查询不到
select * from dba_hist_sqltext q where q.sql_id=‘cct9z95t5ssga‘
---主机信息在 v$session 查询不到
select * from DBA_HIST_ACTIVE_SESS_HISTORY w where w.sql_id=‘cct9z95t5ssga‘
--或者
select * from v$active_session_history w where w.sql_id=‘cct9z95t5ssga‘
标签:order man text ssi info mac name sql_id rom
原文地址:https://www.cnblogs.com/ss-33/p/8918916.html