Database Administration (MOSC)

MOSC Banner

How do I find my own session's serial# ?

edited May 7, 2018 10:01PM in Database Administration (MOSC) 5 commentsAnswered ✓

How do I kill a list of processes, ensuring the executing session is not one of them?

I need both sid SID and SERIAL# and this is the only way I could think of getting them.

PL/SQL snippet:

select  sys_context ('USERENV','SID'),sys_context('USERENV','SESSIONID') INTO  env_sid, env_sessid FROM dual;

select serial$ from gv$session into env_serno where sid=env_sid and audsid=env_sessid;

I thought this would be OK, but after a couple weeks of using it the procedure, a user has complained that they received the  "ORA-01422: exact fetch returns more than requested number of rows".   I assume it was the second statement that produced the error.   We can't reproduce it now.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center