The ways to kill Oracle session

时间:2023-01-21 17:00:36

As we all known ,its the normal way  to use the SQL  'alter system kill 'sid,serial#'' to kill a session,but in some situation ,we hava to kill all the session by the SERVICES,such as deadlock with TM contention.

So,does the Oracle the good idea to deal with this case?

Off course,Oracle provide the procedurce DBMS_SERVICE.DISCONNECT_SESSION .

you can use the following SQL to kill the SERVERs' sessions;

BEGIN
  DBMS_SERVICE.DISCONNECT_SESSION(
    service_name      => 'sales.example.com',
    disconnect_option => DBMS_SERVICE.NOREPLAY);
END;
/