Solved

how to get SQL stament in database auditing?

Posted on 2011-03-17
4
371 Views
Last Modified: 2012-05-11
Hi,

I recently enabled auditing on my database.i audit all DDL,DML.its working fine.when i query SQL> select username, owner, obj_name, action_name,
  2          decode(returncode, '0','Success',returncode) decode,
  3          to_char(timestamp,'DD-MON-YYYY HH24:MI') login
  4          from dba_audit_object;

USERNAME     OWNER           OBJ_NAME   ACTION_NAM DECODE     LOGIN            
------------ --------------- ---------- ---------- ---------- ---------------  
REFERENCE_ST REFERENCE_STAGE MEMBERS    INSERT     Success    10-MAR-2011 05:  
AGE                                                           27                
                                                                               
REFERENCE_ST REFERENCE_STAGE MEMBERS    INSERT     Success    10-MAR-2011 05:  
AGE                                                           27                
                                                                               
REFERENCE_ST REFERENCE_STAGE MEMBERS    INSERT     Success    10-MAR-2011 05:  
AGE                                                           27                
                                                                               
REFERENCE_ST REFERENCE_STAGE MEMBERS    INSERT     Success    10-MAR-2011 05:  

i am getting the results like this.but i want to get  user changed SQL STAMENT(like select * from emp where empno='20').

can anybody tell how to get that .THQ
0
Comment
Question by:Cha1tu
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:Piloute
Comment Utility
Hi,

What's your db version ? I can't quite understand your question but guessing :

In 11.1, dba_audit_object contains a field called SQL_TEXT that actually contains the user's request.

Is this what you want ?

Cheers,
P
0
 
LVL 2

Author Comment

by:Cha1tu
Comment Utility
@Piloute:  Thanks for your quick response.i am unsing 11g only,but when i qery this
SQL> select username, os_username, userhost, SQL_TEXT,priv_used from dba_audit_object where username = 'TEST';

USERNAME   OS_USERNAM   USERHOST  SQL_TEXT   PRIV_USED                              
-------- -             ---------           --------        ----------        ----------                              
TEST              HHKI\ABC          HHK\DEC                                                    
                                                           
                                                                               
TEST              HHKI\ABC          HHK\DEC                                                  
     


i am getting result like this.SQL_TEXT column is blank....its not displaying sql stament              
0
 
LVL 7

Accepted Solution

by:
Piloute earned 500 total points
Comment Utility
Aha... In this case, either your entries were not SQL, OR you missed something in the configuration... What is your AUDIT_TRAIL parameter ?

SQL_BIND & SQL_TEXT need the parameter AUDIT_TRAIL to be one of the following : db,extended or xml,extended. Otherwise they are not populated.

P
0
 
LVL 2

Author Comment

by:Cha1tu
Comment Utility
I set the parameters like this

SQL> show parameter audit;

NAME                                        TYPE                VALUE
----------------------------------- ----------- ------------------------------
audit_file_dest                      string         F:\ORACLE_11G\RDBMS\AUDIT
audit_sys_operations          boolean      TRUE
audit_trail                             string          DB, EXTENDED


but still i am not getting SQL_TEXT..please help me


SQL> select username, os_username, userhost, SQL_TEXT,priv_used from dba_audit_object where username = 'TEST';

USERNAME   OS_USERNAM   USERHOST  SQL_TEXT   PRIV_USED                              
-------- -             ---------           --------        ----------        ----------                              
TEST              HHKI\ABC          HHK\DEC                                                    
                                                           
                                                                               
TEST              HHKI\ABC          HHK\DEC                                                  

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now