Solved

how to get SQL stament in database auditing?

Posted on 2011-03-17
4
380 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
ID: 35157452
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
ID: 35157615
@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
ID: 35159288
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
ID: 35207685
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to recover a database from a user managed backup

776 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