ORA-00027: Cannot Kill Current Session

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarANKUSH THAVALI
  • 01 Dec, 2023
  • 0 Comments
  • 33 Secs Read

ORA-00027: Cannot Kill Current Session

Generally , This error occurs , when you are trying to kill your current session, which is not allowed. EXAMPLE: Get the sid and serial# for the current session.
SQL> select username,inst_id, sid, serial# FROM gV$SESSION WHERE audsid = userenv(‘sessionid’);
USERNAME INST_ID SID SERIAL#
—————————— ———- ———- ———-
SYSTEM 1 242 14

Try to kill the session from current session:
SQL> alter system kill session ‘242,14’ immediate;
alter system kill session ‘242,14’ immediate
*
ERROR at line 1:
ORA-00027: cannot kill current session
Now open another terminal and run the ALTER SYSTEM KILL statement, it will execute successfully.
SQL> alter system kill session ‘242,14’ immediate; 
Session Killed 

Hope it Helps!