Solved

Oracle Audit Table Maintenance

Posted on 2011-09-29
5
543 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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 Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

920 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

12 Experts available now in Live!

Get 1:1 Help Now