根据这段时间的积累,总结几个比较有用查找数据库性能的语句
查处锁定表的session 的sid,serial#,os_user_name, machine name,
terminal 和执行的语句
SELECT l.session_id sid, s.serial#, l.locked_mode, l.oracle_username, s.user#,
l.os_user_name,s.machine, s.terminal,a.sql_text, a.action
FROM v$sqlarea a,v$session s, v$locked_object l
WHERE l.session_id = s.sid
AND s.prev_sql_addr = a.address
ORDER BY sid, s.serial#;
发现551的session被锁定了,询问了下开发人员,时间和操作,确定对生成库没有任何印象。
sid serial
551, 54589'
select * from v$locked_object;再次确认锁定的对象
select * from v$session t where t.SID='551' ;可以根据551,再次确定session
完全无误后
使用赋予了权限的用户,例如:zsdwas
执行:alter system kill session '551,54589';(杀除对应的session)
分析最耗资源的sql语句:
查看oracle最耗资源的sid和用户:
select sid,serial#,username,status,last_call_et from v$session where status='ACTIVE' and username is not null order by last_call_et desc;
查看上面对应uid的sql语句:
select sql_text from v$session a,v$sqltext_with_newlines b where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value and a.sid=191 order by piece;
定位对应的sql语句;
阅读(2238) | 评论(0) | 转发(0) |