Every night at 23:00, we need to stop the user from connecting to the database and terminate individual user sessions.
Immediate is required if you want to kill the session immediately and don’t want Oracle to complete the current operation to complete.
RAC database Syntax –
Since RAC database usually have more than one instance, we need to tell the system I want to kill the session from that specific instance using inst_id
If you don’t pass inst_id on RAC system, then you will end up killing a session on which you connected with privileged user. ( Session may exists or may not exists but still better to give the inst_id )
alter system disconnect session
There is another command which can be used to kill Oracle session
Unlike kill session command, this command kills the dedicated server process (or virtual circuit when using Shared Sever), which is equivalent to killing the server process from the operating system. We can use POST_TRANSACTION in case, we need to wait for the transaction to commit or rollback. We will use immediate,if we want to immediately kill the session.