Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to capture SQL statements that are currently being executed
In article <8plt02$43e$1_at_nnrp1.deja.com>,
gzwzhang_at_my-deja.com wrote:
> I found that my old method (using v$sqlarea, v$sqltext) can't grab the
> SQl statement coming from Java--Jdbc. I guess JDBC did
> something to the original SQL statements written by Java/SQl
> programmer. I know that I can turn on the sql_trace, but that will
> cause some extra overhead. I don't want to trace any sql at any time.
> ONly when something happened and the Oracle seems abnormal will I
have
> a look at what's current running.
> Any idea will be highly appreciated.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
I use the query below on our website database. All connections are through JDBC, but there are some stored procedures being run. In any case, the query listed below returns statements for every session in the datbase. Hope this Helps.
Patrick
column username format a15
select a.sid, a.username, b.sql_text
from v$session a, v$sqltext b
where a.sql_address = b.address
and a.sql_hash_value = b.hash_value
order by a.sid, a.username, b.piece
/
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Sep 12 2000 - 14:15:15 CDT
![]() |
![]() |