Solved

Oracle Audit Table Maintenance

Posted on 2011-09-29
5
554 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
[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
5 Comments
 
LVL 74

Assisted Solution

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

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 77

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

734 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