Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Jan.

Asked: December 20, 2018 - 2:38 pm UTC

Last updated: December 24, 2018 - 1:39 am UTC

Version: 12.1.0.2

Viewed 1000+ times

You Asked

Hi Tom,
Wondering your thoughts on why the session id of sys user is hard coded to 429496729.
SQL> select sys_context('userenv','sessionid') from dual;
When you run this connected as sysdba it always returns 429496729.
The same select using sid instead of sessionid does return a different number.
What are you thoughts on this as we are logging session id and time stamp to a log table when we are connected to sys.
Thanks!!
Jan

and Connor said...

sys_context('userenv','sessionid') returns the value in AUDSID in v$session, which is populated by an internal sequence that goes up for non-sys sessions but is a fixed constant for SYS. That's just the way it works. It ultimately is the number that will be used as a key into sys.aud$ for auditing connections.

For me - I would keep the logins as SYS to an absolute minimum. If you "never" log in as SYS, then any login as SYS will immediately stand out as being anomalous.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Security

All of the vital components for a secure database are covered in the Security guide.