Solved

Scripts need for purging the auditing data

Posted on 2011-09-14
4
365 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
Comment Utility
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)
Comment Utility
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
Comment Utility
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
Comment Utility
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

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

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…
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 set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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…

771 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

11 Experts available now in Live!

Get 1:1 Help Now