关闭

瑣表的查询和處理方法

286人阅读 评论(0) 收藏 举报
分类:

查詢瑣表 


select object_id,session_id,locked_mode from v$locked_object; 
   
select t2.username,t2.sid,t2.serial#,t2.logon_time  
    from v$locked_object t1,v$session t2  
    where t1.session_id=t2.sid order by t2.logon_time;

 

SELECT /*+ rule */ s.username,
decode(l.type,'TM','TABLE LOCK',
'TX','ROW LOCK',
NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,
s.sid,s.serial#,s.paddr,s.terminal,s.machine,s.program,s.osuser
FROM v$session s,v$lock l,dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT Null

(注意:这里查询了v$session中的paddr,这和v$process中的addr对应)

 

查詢造成瑣表的語句


select  sql_text from v$sql where sql_id in(select  prev_sql_id from v$session where sid='SID');


處理瑣表  


select sid,serial#,status,sql_address from v$session where sid=''


alter system kill session 'SID,SERIAL#'

 


OS层面查杀oracle死掉的会话

select pid,spid from  v$process where addr='paddr'

ps -ef|grep LOCAL

kill -9 spid

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:5186次
    • 积分:135
    • 等级:
    • 排名:千里之外
    • 原创:7篇
    • 转载:6篇
    • 译文:0篇
    • 评论:0条
    文章存档