Solved

Scripts need for purging the auditing data

Posted on 2011-09-14
4
379 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
[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
  • 3
4 Comments
 
LVL 74

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 77

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 74

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 74

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

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

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 post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
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…

756 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