Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: What's my session's pid?
select sid from v$mystat where rownum=1;
is shorter...
-- Syltrem http://pages.infinit.net/syltrem (OpenVMS related web site, en français) "NetComrade" <netcomradeNSPAM_at_bookexchange.net> a écrit dans le message de news:43020723.79247625_at_localhost...Received on Wed Aug 17 2005 - 09:28:36 CDT
> Is there are a more elegant way to know my pid?
>
> I've modified T. Kyte's method of 'Alternative Solution to Provide
> Worry-Free Access [to sql trace output' from his Effective Oracle by
> Design book (pages 129-135), to allow in session viewing of the trace
> file, since his method required a logoff, which would populate a table
> with trace file name.
>
> Basically I did the following.
>
> I left the trace_files user alone.
>
> grant select on v_$process to trace_files with grant option;
> grant select on v_$session to trace_files with grant option;
> grant select on v_$instance to trace_files with grant option;
>
> create or replace view session_trace_file_name
> as
> select lower(d.instance_name) || '_ora_' || ltrim(to_char(a.spid)) ||
> '.trc' filename
> from v$process a, v$session b, v$instance d
> where a.addr = b.paddr
> and b.audsid = sys_context ('userenv','sessionid');
>
> grant select on session_trace_file_name to public;
>
> And it seems to work.. fine.
>
> So.. any drawbacks, and/or better way to do this?
>
> thanks.
>
> .......
> We use Oracle 8.1.7.4 and 9.2.0.6/7 on Solaris 2.7 and RH4
> remove NSPAM to email
![]() |
![]() |