{"id":350,"date":"2024-07-21T15:52:30","date_gmt":"2024-07-21T15:52:30","guid":{"rendered":"https:\/\/humtechno.com\/intro\/?p=350"},"modified":"2024-07-21T15:52:49","modified_gmt":"2024-07-21T15:52:49","slug":"check-blocking-session-and-kill","status":"publish","type":"post","link":"https:\/\/humtechno.com\/intro\/2024\/07\/21\/check-blocking-session-and-kill\/","title":{"rendered":"Check Blocking Session and Kill"},"content":{"rendered":"\n\n\n\n<p><strong>Find and Kill session at Database Level<\/strong><\/p>\n\n<p>select &#8216;alter system kill session&#8217; || &#8221;&#8221; || sid || &#8216;,&#8217; || serial# || &#8221;&#8221; || &#8216;immediate;&#8217;, username, sid,serial#,sql_id , wait_time from v$session where (sid ) in<br>(<br>select blocking_session from v$session<br>);<\/p>\n\n<p>select &#8216;alter system kill session&#8217; || &#8221;&#8221; || sid || &#8216;,&#8217; || serial# || &#8221;&#8221; || &#8216;immediate;&#8217; , username, sid,serial#,sql_id , wait_time from v$session where sid in<br>(select holding_session from dba_blockers);<\/p>\n\n<p><strong>Checky user Level Locking<\/strong><\/p>\n\n<p>SELECT se.inst_id,se.last_call_et,<br>lk.SID, se.username, se.OSUser, se.Machine,DECODE (lk.TYPE,&#8217;TX&#8217;, &#8216;Transaction&#8217;,&#8217;TM&#8217;, &#8216;DML&#8217;,&#8217;UL&#8217;, &#8216;PL\/SQL User Lock&#8217;,lk.TYPE)<br>lock_type, DECODE (lk.lmode, 0, &#8216;None&#8217;, 1, &#8216;Null&#8217;,<br>2, &#8216;Row-S (SS)&#8217;,<br>3, &#8216;Row-X (SX)&#8217;,<br>4, &#8216;Share&#8217;,<br>5, &#8216;S\/Row-X (SSX)&#8217;,<br>6, &#8216;xclusive&#8217;,<br>TO_CHAR (lk.lmode))<br>mode_held,<br>DECODE (lk.request,<br>0, &#8216;None&#8217;,<br>1, &#8216;Null&#8217;,<br>2, &#8216;Row-S (SS)&#8217;,<br>3, &#8216;Row-X (SX)&#8217;,<br>4, &#8216;Share&#8217;,<br>5, &#8216;S\/Row-X (SSX)&#8217;,<br>6, &#8216;Exclusive&#8217;,<br>TO_CHAR (lk.request))<br>mode_requested,<br>TO_CHAR (lk.id1) lock_id1,<br>TO_CHAR (lk.id2) lock_id2,<br>ob.owner,<br>ob.object_type,<br>ob.object_name,<br>DECODE (lk.Block, 0, &#8216;No&#8217;, 1, &#8216;Yes&#8217;, 2, &#8216;Global&#8217;) block,<br>se.lockwait<br>FROM GV$lock lk, dba_objects ob, GV$session se<br>WHERE lk.TYPE IN (&#8216;TX&#8217;, &#8216;TM&#8217;, &#8216;UL&#8217;)<br>AND lk.SID = se.SID<br>AND lk.id1 = ob.object_id(+)<br>AND lk.inst_id = se.inst_id<br>and last_call_et &gt; 100;<\/p>\n\n<p><strong>Kill Session at OS find Used Objects<\/strong><\/p>\n\n<p>select \/<em>+rule+<\/em>\/ &#8216;kill -9 &#8216; || c.spid from v$access a , v$session b ,v$process c<br>where a.sid=b.sid<br>and c.addr=b.paddr<br>and a.object like &#8216;%F_BATCH%&#8217;;<\/p>\n\n<p> <\/p>\n\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":333,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-350","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle"],"_links":{"self":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/comments?post=350"}],"version-history":[{"count":2,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":352,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/posts\/350\/revisions\/352"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media\/333"}],"wp:attachment":[{"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/media?parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/categories?post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/humtechno.com\/intro\/wp-json\/wp\/v2\/tags?post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}