Solved

Scripts need for purging the auditing data

Posted on 2011-09-14
4
368 Views
Last Modified: 2013-12-19
Hi,

Can any one Please tell me how to write a script for purging the audit data from tables .

I am using the windows, i want to shedule the job using SHEDULED TASKS

I need to 2 scripts

1st is for purging the auditing data from source table ( database1) to Stage table (database 2) .
I want to keep the data in stage table for 3 months.

2nd is   purging the auditing data from Stage table(database 2) to Final table(database 2)
I want to keep the data in final table for 1 year.

Thanks
0
Comment
Question by:Cha1tu
  • 3
4 Comments
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 36537222
purging "to" something doesn't make sense

a purge is a removal, so they don't go anywhere.


3 month purge...

delete your_audit_table where your_audit_timestamp < add_months(sysdate,-3)

12 month purge...

delete your_audit_table where your_audit_timestamp < add_months(sysdate,-12)
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36537246
I believe they want to 'archive' then remove.

Use the date values above to export/import between the databases.
0
 
LVL 73

Expert Comment

by:sdstuber
ID: 36537247
if you want to copy audit records from one database to another,  you've already asked that multiple times


for instance...

http://www.experts-exchange.com/Database/Oracle/Q_26927373.html

only thing different here is writing the records across a db link, which you also asked about

and including the timestamp where clause as above.
0
 
LVL 73

Expert Comment

by:sdstuber
ID: 36537264
I knew I had answered the auditing move question recently,  but it wasn't you

it was a different asker..., sorry for the confusion

http://www.experts-exchange.com/Database/Oracle/Q_27261461.html
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

Suggested Solutions

Title # Comments Views Activity
Oracle RMAN Database Restore 5 52
FRM-40735:KEY-COMMIT trigger raised unhandled exception ORA-01422 7 56
SQL Retrieve Values 4 57
case statement in where clause 5 42
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

895 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

15 Experts available now in Live!

Get 1:1 Help Now