Solved

Oracle Audit Table Maintenance

Posted on 2011-09-29
5
547 Views
Last Modified: 2012-05-12
Hello, we have implemented session level auditing of our Oracle payroll application and I'm wondering what is the best practice method to purge some of the data on a routine basis.  We are only required to keep a years worth of auditing records and as of right now we have about 2.5 in there.  The size of the audit data is actually growing larger than the actual data.  We would only be doing this purge once a year.

I'm a SQL Server person, so forgive my Oracle ignorance. :)
0
Comment
Question by:Roxanne25
  • 2
  • 2
5 Comments
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 125 total points
ID: 36816376
delete from your_audit_table where audit_timestamp < sysdate - 365
0
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 125 total points
ID: 36816389
if doing the delete in one step exceeds your rollback/undo limits  then try this...  adjust the 100000 to be as large as your undo will handle

note  I changed the sysdate-365 to the slightly more accurate    add_months(trunc(sysdate), -12)


BEGIN
        LOOP
            DELETE FROM your_audit_table
                  WHERE audit_timestamp < add_months(trunc(sysdate), -12) AND ROWNUM <= 100000;

            EXIT WHEN SQL%ROWCOUNT = 0;
            COMMIT;
        END LOOP;
END;
0
 

Author Comment

by:Roxanne25
ID: 36816741
Thanks guys that is quite helpful!

One more question though... you say your_audit_table as the table name but the tables I wish to prune are the system audit tables (SYS.AUD$).  Is it the same procedure for the system tables?  I was just concerned because I didn't know how permissions work around deleting information from system audit tables.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 375 total points
ID: 36817054
The 10g docs say to just delete them:  Purging Audit Records from the Audit Trail

http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/cfgaudit.htm

The 11g docs have other options:  Selecting an Audit Trail Purge Method

http://download.oracle.com/docs/cd/E11882_01/network.112/e16543/auditing.htm

0
 

Author Comment

by:Roxanne25
ID: 36817191
Great thank you!  That is helpful.... now just need to research this DBMS AUDIT MGMT :)
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

Suggested Solutions

Title # Comments Views Activity
Convert Oracle data into XML document 2 67
Use of Exception to end a Loop 3 34
what privileges needed for S2 for this function (Oracle 12c)? 3 22
Oracle dataguard 5 32
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 post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

832 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