Home » RDBMS Server » Server Administration » How can I get the audited SQL "statement"?
How can I get the audited SQL "statement"? [message #62709] Tue, 10 August 2004 20:54 Go to next message
Tian Maohuai
Messages: 23
Registered: December 2003
Junior Member
I have a program ,it's data is store in Oracle,but I have no source code of the program,I try to understand the application operation logic through audit the table DML,after I do a application GUI operation,I find changes in SYS.AUD$ table,I can only see what type of DML is done,BUT,I WANT TO SEE THE EXACT SQL STATEMENT EXECUTED.which VIEWs should I join with the AUD$ to find the statements ?and how to join?
Re: How can I get the audited SQL "statement"? [message #62714 is a reply to message #62709] Tue, 10 August 2004 21:30 Go to previous messageGo to next message
Daljit Singh
Messages: 290
Registered: October 2003
Location: Texas
Senior Member
Hi,

First run transaction from ur application then in oracle query V$SESSION & try to find out your application session using some columns like MACHINE, USERNAME, OSUSER, PROGRAM etc. After identifing ur session, use that SID & SERIAL# to find exact SQL from V$SQLAREA view.

You can simply join both V$SESSION & V$SQLAREA to find exact SQL from different sessions, in WHERE clause use appropriate filters to identify ur application session as described above.

Here is a small script :

select a.sql_text from
v$sqlarea a, v$session b
where a.hash_value = b.sid
and a.address = b.saddr
and b.program = 'TOAD' -- use ur application name here

Daljit Singh.
Re: How can I get the audited SQL "statement"? [message #62755 is a reply to message #62714] Wed, 11 August 2004 18:22 Go to previous message
Tian Maohuai
Messages: 23
Registered: December 2003
Junior Member
Thank you Daljit,your answer is good,but perhaps you misunderstand my meaning.what I really want is HOW CAN I DEFINE A VIEW(based on some system views),AND WHEN I DO EVERY APPLICATION OPERATION,I CAN SEE A RELEVANT RECORD(including SQL text) IN MY VIEW.
Previous Topic: default index tablespace
Next Topic: rollback segments
Goto Forum:
  


Current Time: Fri Sep 27 08:29:09 CDT 2024