Skip to Main Content
  • Questions
  • Database link : Relation of sessions between databases


Question and Answer

Connor McDonald

Thanks for the question, Sébastien.

Asked: August 30, 2021 - 2:09 pm UTC

Last updated: October 11, 2021 - 10:52 am UTC

Version: 11g 12c 19c

Viewed 100+ times

You Asked


In the context of database link, is there a possibility to get the relation between both sessions of database "A" and database "B"? (database "A" query objects from database "B" using a dblink)
In other words, from database "B" can we retrieve the SID of database "A" that create the session in database "B" (and vis versa, from database "A" the SID of database "B" that is created for the dblink)?

I hope that my question is understandable.

Thank you very much,

and Connor said...

From the perspective of the receiving database, the request is just like another client. You might be able to glean from information from the session details.

eg A normal remote connection coming to my database with SQLPlus

SQL> select * from v$session where sid = 124
  2  @pr
SADDR                         : 00007FFC20C1CA88
SID                           : 124
SERIAL#                       : 52150
AUDSID                        : 30290777
PADDR                         : 00007FFC205B2C68
USER#                         : 107
OSUSER                        : connor
PROCESS                       : 3424:1308
MACHINE                       : XPS13
PORT                          : 62660
TERMINAL                      : XPS13
PROGRAM                       : sqlplus.exe
TYPE                          : USER

and here is a connection coming via a database link (from the database running on the same remote machine as above)

SQL> select * from v$session where sid = 497
  2  @pr
SADDR                         : 00007FFC1F2117F0
SID                           : 497
SERIAL#                       : 33833
AUDSID                        : 30290782
PADDR                         : 00007FFC20618950
USER#                         : 107
OSUSER                        : OracleServiceDB19
PROCESS                       : 4724:11880
MACHINE                       : XPS13
PORT                          : 62725
TERMINAL                      : XPS13
PROGRAM                       : ORACLE.EXE
TYPE                          : USER
MODULE                        : ORACLE.EXE

Those values will vary by platform (the ones above are Windows) but you get the idea.

Also some (unsupported) options here


  (1 rating)



Sébastien Tromme, October 11, 2021 - 7:35 am UTC

Thank you for your feedback.
Connor McDonald
October 11, 2021 - 10:52 am UTC

glad we could help

More to Explore


Need more information on Administration? Check out the Administrators guide for the Oracle Database