Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: how to find session id/serial no. of current session

Re: how to find session id/serial no. of current session

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/10/06
Message-ID: <3439c88f.1964404@newshost>#1/1

On Mon, 06 Oct 1997 08:13:35 +0200, Martin Haltmayer <Martin_Haltmayer_at_KirchGruppe.de> wrote:

>Thomas Kyte wrote:
>>
>> On Sun, 5 Oct 1997 01:04:35 +0800, "S S Wan" <sswan_at_hk.super.net> wrote:
>>
>> >Does anybody know how to find the session id and serial number
>> >of the current session?
>> >
>> >Thanks.
>> >
>>
>> select sid, serial# from v$session where audsid = userenv('sessionid');
>>
>> will do it....
>>
>
>It will only for a user having SELECT ANY TABLE privilege. That's
>exactly the problem...

why select any table? Why not just grant access to the one view?

grant select on v_$session to Whomever (public, specific people, a role, whatever). v$session is a public synonym on the view v_$session in the sys schema.

You could create a view (as the user sys)

create view Your_Session
as
select * from v$session where audsid = username('sessionid');

create public synonym your_session for your_session; grant select on your_session to public;

In that way, your_session will always be a 1 row view with just your stuff in it.

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Oct 06 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US