[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

how to get SQL stament in database auditing?

Posted on 2011-03-17
4
Medium Priority
?
407 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to recover a database from a user managed backup

650 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