Heim  >  Artikel  >  Datenbank  >  Oracle 根据v$wait_chains找到造成等待的SQL

Oracle 根据v$wait_chains找到造成等待的SQL

WBOY
WBOYOriginal
2016-06-07 17:11:311139Durchsuche

Oracle 根据v$wait_chains找到造成等待的SQL

几个视图的功能,来自官方文档
v$sqltext
V$SQLTEXT displays the text of SQL statements belonging to shared SQL cursors in the SGA.

V$SESSION
V$SESSION displays session information for each current session.

v$wait_chains
V$WAIT_CHAINS
displays information about blocked sessions. A wait chain is comprised of sessions that are blocked by one another. Each row represents a blocked and blocker session pair. If a wait chain is not a cyclical wait chain, then the last row for the chain does not have a blocker.

找到造成等待的SQL

  • select * from v$sqltext 
  •     where 
  •         (hash_value,address) in 
  •     ( 
  •         SELECT DECODE(sql_hash_value, 0, prev_hash_value, sql_hash_value), 
  •             DECODE(sql_hash_value, 0, prev_sql_addr,sql_address) 
  •         FROM v$session 
  •             where sid in (select sid from v$wait_chains) 
  • ); 
  • linux

    Stellungnahme:
    Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn