Re: hacking V$MYSTAT into "V$MYSESSION"
Date: Fri, 29 Mar 2019 18:25:02 +0000
Message-ID: <9bb1c99b-4e13-2fdd-9bf1-e3e3a4a48afc_at_dunbar-it.co.uk>
On 29/03/2019 13:39, Oleksandr Denysenko wrote:
> Hi,
>
> like this one ?
>
> create view SYS.v_$mysession as select * from v$session where
> username=user;
Log in to the same user twice, or more, then run a select from the view again - I rather suspect it might fail.
I would change the WHERE clause to something more selective, such as, for example, maybe:
where sid = (select sid from v$mystat where rownum = 1)
Or, grab some data from SYS_CONTEXT('USERENV', '???') that could be used.
Or there might be something you can do with AUDSID (If that's the correct name for it) etc etc etc.
Most of my databases have numerous connections to the same user which would fail the original view's code.
(Unless I'm talking complete and utter nonsense (again) of course, I'm not sitting at or near a database at the moment.)
Cheers,
Norm.
-- Norman Dunbar Dunbar IT Consultants Ltd Registered address: 27a Lidget Hill Pudsey West Yorkshire United Kingdom LS28 7LG Company Number: 05132767 -- http://www.freelists.org/webpage/oracle-lReceived on Fri Mar 29 2019 - 19:25:02 CET