【Oracle】Oracle解鎖、Oracle鎖表處理

來源:互聯網
上載者:User

標籤:鎖定   哪些   where   too   方法   src   suse   convert   system   

1、查看哪些對象被鎖

select 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.terminal,       s.machine,       s.program,       s.osuser  from v$session s, v$lock l, dba_objects o where s.sid = l.sid   and o.object_id = l.id1   and s.username is not null;

 

2、下面的語句用來殺死一個進程:

 alter system kill session ‘33,456‘; ---其中33,456分別是上面查詢出的sid,serial#

 

3、再一次查詢目前鎖定的對象,若發現以上方法不能解除鎖定的表,則用以下方法:

(1)執行下面的語句獲得進程(線程)號:

select spid, osuser, s.program  from v$session s, v$process p where s.paddr = p.addr   and s.sid = 33;---33是上面的sid

(2)在OS上kill掉這個進程

  Linux:

kill -9 3333 (3333為進程號)

  Windows(unix也適用)用orakill殺死線程,orakill是oracle提供的一個可執行命令,文法為:  orakill sid thread  

  sid:表示要殺死的進程屬於的執行個體名  thread:是要殺掉的線程號,即第3步查詢出的spid。  

  例:

c:>orakill orcl 3333

 

【Oracle】Oracle解鎖、Oracle鎖表處理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.