{"id":1119,"date":"2026-04-16T11:46:57","date_gmt":"2026-04-16T09:46:57","guid":{"rendered":"https:\/\/anjo.pt\/keyword-oracle\/?p=1119"},"modified":"2026-04-16T11:46:57","modified_gmt":"2026-04-16T09:46:57","slug":"alter-system-kill-session-force-timeout-0-new-form-of-kill-immediate","status":"publish","type":"post","link":"https:\/\/anjo.pt\/keyword-oracle\/2026\/04\/16\/alter-system-kill-session-force-timeout-0-new-form-of-kill-immediate\/","title":{"rendered":"Alter system kill session &#8220;force timeout 0&#8221; ? new form of &#8220;kill immediate&#8221;?"},"content":{"rendered":"\n<p>The other day I saw that besides the catcon.pl, there is a catcon_kill_sess_gen.sql:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nls -1 $ORACLE_HOME\/rdbms\/admin\/catcon*\n\/u00\/app\/oracle\/product\/19.30.0\/rdbms\/admin\/catcon_kill_sess_gen.sql\n\/u00\/app\/oracle\/product\/19.30.0\/rdbms\/admin\/catcon.pl\n\/u00\/app\/oracle\/product\/19.30.0\/rdbms\/admin\/catcon.pm\n\/u00\/app\/oracle\/product\/19.30.0\/rdbms\/admin\/catconst.pm\n\/u00\/app\/oracle\/product\/19.30.0\/rdbms\/admin\/catcont.sql\n<\/pre><\/div>\n\n\n<p>When looking at this file, I noticed it kills catcon session using a &#8220;ALTER SYSTEM KILL SESSION &#8216;sid, serial#&#8217; FORCE TIMEOUT 0&#8221;, except if on Oracle 12.1, where still does &#8220;IMMEDIATE&#8221; instead:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2026\/04\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"136\" src=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2026\/04\/image.png\" alt=\"\" class=\"wp-image-1120\" srcset=\"https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2026\/04\/image.png 627w, https:\/\/anjo.pt\/keyword-oracle\/wp-content\/uploads\/sites\/3\/2026\/04\/image-300x65.png 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/a><\/figure>\n\n\n\n<p>This new syntax &#8220;FORCE TIMEOUT x&#8221; is first described in <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/26\/sqlrf\/ALTER-SYSTEM.html\" target=\"_blank\" rel=\"noreferrer noopener\">Oracle AI 26ai DB documentation<\/a> (but it seems to work from version 12.2). Basically it theoretically allows the draining of sessions by setting a timeout until the session terminates some task, before killing it.<\/p>\n\n\n\n<p>There are two new elements here: &#8220;FORCE&#8221; and &#8220;TIMEOUT x&#8221;.<\/p>\n\n\n\n<p>What I understood from documentation is:<\/p>\n\n\n\n<p>When not using the &#8220;FORCE&#8221;  keyword, the two following commands behave the same way:<\/p>\n\n\n\n<p>ALTER SYSTEM KILL SESSION &#8216;sid, serial#&#8217; <strong>IMMEDIATE <\/strong>= ALTER SYSTEM KILL SESSION &#8216;sid, serial#&#8217; <strong>TIMEOUT 0<\/strong><\/p>\n\n\n\n<p>Basically, it instructs Oracle to terminate a session and roll back ongoing transactions, release all session locks, recover the entire session state, and return control to you immediately.<\/p>\n\n\n\n<p>With the &#8220;FORCE&#8221; keyword alone, it terminates the session like &#8220;IMMEDIATE&#8221;, however waiting first for a timeout of 5 seconds.<\/p>\n\n\n\n<p>With the &#8220;FORCE TIMEOUT 0&#8221;, then the connection is closed immediately, when there is some activity going on.<\/p>\n\n\n\n<p>Here a summary of what I observed:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>ALTER SYSTEM KILL SESSION command:<\/th><th>Kill idle session<\/th><th>Kill ongoing select<\/th><\/tr><\/thead><tbody><tr><td>&#8230; IMMEDIATE<\/td><td><strong>Killer<\/strong>:<br>System altered.<br><strong>Killed <\/strong>session: <br>ORA-03135: connection lost contact<br>ORA-03114: not connected to ORACLE<\/td><td><strong>Killer<\/strong>:<br>ORA-00031: session marked for kill<br><strong>Killed <\/strong>session:<br>ORA-00028: your session has been killed<\/td><\/tr><tr><td>&#8230; FORCE<\/td><td><strong>Killer<\/strong>:<br>System altered.<br><strong>Killed <\/strong>session: <br>ORA-03135: connection lost contact<br>ORA-03114: not connected to ORACLE<\/td><td><strong>Killer<\/strong>:<br>System altered.<br><strong>Killed <\/strong>session:<br>ORA-00028: your session has been killed<\/td><\/tr><tr><td>&#8230; TIMEOUT 0<\/td><td><strong>Killer<\/strong>:<br>System altered.<br><strong>Killed <\/strong>session:<br>ORA-00028: your session has been killed<br>ORA-01012: not logged on<\/td><td><strong>Killer<\/strong>:<br>ORA-00031: session marked for kill<br><strong>Killed <\/strong>session:<br>ORA-00028: your session has been killed<\/td><\/tr><tr><td>&#8230; FORCE TIMEOUT 0;<\/td><td><strong>Killer<\/strong>:<br>System altered.<br><strong>Killed <\/strong>session: <br>ORA-03135: connection lost contact<br>ORA-03114: not connected to ORACLE<\/td><td><strong>Killer<\/strong>:<br>System altered.<br><strong>Killed <\/strong>session:<br>ORA-03113: end-of-file on communication channel<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Just for completion, if using &#8220;DISCONNECT SESSION&#8221; instead, then the session might just automatically failover if the parameters are correctly set.<\/p>\n\n\n\n<p>Le me know if you have other inputs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The other day I saw that besides the catcon.pl, there is a catcon_kill_sess_gen.sql: When looking at this file, I noticed it kills catcon session using a &#8220;ALTER SYSTEM KILL SESSION &#8216;sid, serial#&#8217; FORCE TIMEOUT 0&#8221;, except if on Oracle 12.1, where still does &#8220;IMMEDIATE&#8221; instead: This new syntax &#8220;FORCE TIMEOUT x&#8221; is first described in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,90],"tags":[],"class_list":{"0":"post-1119","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-oracle","7":"category-oracle-ai-26ai","8":"czr-hentry"},"_links":{"self":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/1119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/comments?post=1119"}],"version-history":[{"count":1,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/1119\/revisions"}],"predecessor-version":[{"id":1121,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/1119\/revisions\/1121"}],"wp:attachment":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/media?parent=1119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/categories?post=1119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/tags?post=1119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}