--查看最耗磁盘读写率的磁盘语句
select *
from (select v.sql_id,
v.child_number,
v.sql_text,
v.elapsed_time,
v.cpu_time,
v.disk_reads,
rank() over(order by v.disk_reads desc) elapsed_rank
from v$sql v) a
where elapsed_rank <= 10;
--查看产生表锁的语句,可以的到SID号
select * from v$lock where type=‘TX‘;
--查看会话,根据SID和serial#字段可以断开该会话
select * from v$session where sid=147;
select * from v$session where sid=138;
--查看产生死锁的机器
select username,sid,serial#,lockwait,status,machine,program from v$session where sid in
(select session_id from v$locked_object)
--断开会话
alter system kill session ‘138,45‘;
--查看产生死锁的SQL语句
select sql_text from v$sql where hash_value in
(select sql_hash_value from v$session where sid in
(select session_id from v$locked_object))
时间: 2024-10-18 19:05:33