14
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【oracle】負荷の高いクエリ調査&デッドロックの解除方法

Posted at

oracleの負荷が高いときに原因となっているクエリや
デッドロックしているクエリを見つけ対応する方法です。

負荷の高いクエリ調査

select 
a.sid,a.serial#,a.sql_hash_value, a.sql_address,a.machine,a.username,a.event,
b.sql_text, b.elapsed_time,b.executions,b.disk_reads,b.cpu_time,
b.OPTIMIZER_COST,b.BUFFER_GETS,b.ROWS_PROCESSED
from v$session a,v$sql b
where a.sql_address = b.address
and a.sql_hash_value = b.hash_value
and a.status = 'ACTIVE'
order by b.elapsed_time desc;

デッドロックしているクエリの調査

SELECT SID, SERIAL# FROM V$SESSION
WHERE SID IN (SELECT SID FROM V$LOCK WHERE TYPE IN ('TM','TX'));

解除方法

alter system kill session 'sid, serial#' immediate;
例)alter system kill session '103, 42957' immediate;
14
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?