not what am looking for
prasannakrishna, March 10, 2017 - 9:21 am UTC
I want sessionID for some other purpose and SID will not serve that purpose.
What would sys_context('userenv','sessionid') return if multiple instances are running in RAC?
March 11, 2017 - 1:53 am UTC
No it will not.
But I'm doing to know what "other purpose" is :-)
Prasannakrishna, March 13, 2017 - 5:31 am UTC
ONE of the purpose is to distinguish oracle background process form user process.
So there is no way to get sessionID through sys_context in RAC environment other than querying gv$session table.
March 14, 2017 - 3:58 am UTC
If you're querying the information about a session *other* than the one you are in, then you'll always be querying v$session / gv$session.
If you need information about the session you are *in*, then by definition you are in a foreground session. The only exception to that would be perhaps if you define a scheduler job as a background job, in which case, the sys_context function can also give you information about jobs (see BG_JOB_ID/FG_JOB_ID)