Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

v$session.username and v$session.program assignments

571956Aug 27 2009 — edited Aug 31 2009
All -

I found the following query to figure out the sid and serial number to kill a session. I use it whenever I need to do so. However, I wrote an Oracle package that I've found does not show me the username and program when I run the query. Is there a way I can specify the program name or the username in this query so I can easily decipher which session I want?

Thanks,
ivalum21

SELECT
	p.spid "Thread ID",
	s.sid "Session ID",
	s.serial# "Serial Num",
	b.name "Background Process",
	s.sql_id "SQL ID",
	s.username "Session User",
	s.osuser "OS User",
	s.status "Status",
	s.program "Program"
FROM
	v$process p,
	v$bgprocess b,
	v$session s
WHERE s.status = 'ACTIVE'
	AND s.paddr = p.addr
	AND b.paddr(+) = p.addr
	AND b.name IS NULL
ORDER BY s.username ;
Edited by: ivalum21 on Aug 27, 2009 3:48 PM
This post has been answered by 247514 on Aug 27 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2009
Added on Aug 27 2009
5 comments
1,647 views