Search notes:

Oracle: Identify one's own session

The «own» session can be identified with v$session and sys_context:
select * from v$session where sid    = sys_context('userenv', 'sid'      );
select * from v$session where audsid = sys_context('userenv', 'sessionid');
If dbms_support is installed, the corresponding record can also be found with dbms_support.mysid:
select * from v$session where sid=sys.dbms_support.mysid;
Alternatively, dbms_session.unique_session_id can be used from which value the session's sid, serial# and instance can be calculated.
In addition to the session id, the session serial number can be queried like so:
select
   dbms_debug_jdwp.current_session_id       sid,
   dbms_debug_jdwp.current_session_serial   serial#
from
   dual;

See also

The SQL script mysid.sql returns the own session's SID (intended to be stored in the $SQLPATH directory)
SAS: Determine Oracle session's sid and serial

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1740556941, '3.145.182.183', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/installed/dynamic-performance-views/session/identify-own-session(56): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78