[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Scripts need for purging the auditing data

Posted on 2011-09-14
4
Medium Priority
?
403 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 74

Accepted Solution

by:
sdstuber earned 2000 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 78

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Suggested Courses

872 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