Solved

Oracle Audit Table Maintenance

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

Join & Write a Comment

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…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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.
This video shows how to recover a database from a user managed backup

708 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

18 Experts available now in Live!

Get 1:1 Help Now