Why sid required in 'KILL SESSION' (Oracle SQL)?

oracle, sessionid, sql

Solution

I found it! Sequence for `serial#` is cyclic. Numbers will be reused after 2 billions logins if `int` used, or after 32k if `short` used. So, using `serial#` without anything else doesn't provide really unique enumerating. But `sid` is unique at a moment. So, pair `sid,serial#` is really unique. You can't use `serial#` or `sid` to manage sessions, you should use it in a pair.

Thank you for your time!

Problem

I have exam question and can't find answer. Why `sid` is mandatory required to perform `KILL SESSION` command? `KILL SESSION` syntax: `ALTER SYSTEM KILL SESSION 'sid,session#[@inst_id]' [IMMEDIATE];` Where sid is a 'unique' session identifier. Unique in quotes because it is unique in current moment, Oracle server can have, for example, session some sid, but after this session is over, this sid can be used for other session. `Sid` is analogy `pid` in OS. Session# is a serial session number; it is a session counter. Server clear the counter at DB startup. So, session# is a really unique identifier for session. I don't understand why `sid` is mandatory for `KILL SESSION` command. I think, it is possible to use `session#` only. Thanks.

Original source