Re: hacking V$MYSTAT into "V$MYSESSION"

  • From: Norman Dunbar <oracle@xxxxxxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Fri, 29 Mar 2019 18:25:02 +0000

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
--
//www.freelists.org/webpage/oracle-l


Other related posts: