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: User SQL Statements

Re: User SQL Statements

From: <mccmx_at_hotmail.com>
Date: 11 May 2006 00:10:18 -0700
Message-ID: <1147331418.696699.133340@i39g2000cwa.googlegroups.com>

J Huntley Palmer wrote:
> What is the best way to get log of a sql statements that a particular
> user or connection is sending?
>

It depends on what you want. If you just want to see the SQL that a sesion is currently running then use:

select sql_address from v$session where sid = <sid of sesssion>;

If you want to record a log of all SQL that a session has executed then you need to enable a trace for that session. There are loads of different ways to do this but I use:

exec dbms_system.set_ev(<sid>,<serial#>,10046,8,' ');

This will give a trace file in the database 'udump' directory which contains all of the SQL which the session ran, how long each SQL took, what resources were used to satisfy the query and any 'waits' that occurred during the execution of the SQL.

(You haven't included your platform or version...)

Matt Received on Thu May 11 2006 - 02:10:18 CDT

Original text of this message

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