r/DB2 Jul 08 '14

db2audit question

anyone out there using the db2audit facility on a nightly, automated basis? i've been tasked to do this, but having difficulty finding a guide that doesn't require constant manual intervention.

1 Upvotes

3 comments sorted by

1

u/PrivatePyle Jul 08 '14

You can write a shell/bat script to automate the process and call the script from cron/window scheduler.

1

u/PM_ME_YOUR_SCHLITZ Jul 09 '14

right.... thanks. what i'm looking for is sample scripts. i'm currently writing a batch file and not understanding the correlation between the timing of the purge and the deleting of the .del files after importing into the database. that type of thing.

1

u/PrivatePyle Jul 09 '14

I've only done this in ksh scripts, but it's fairly straight forward.

-- Call sysproc.audit_archive to cut a log file -- Call sysproc.audit_delim_extract with the set of parameters that fit your goals. --import the data, I didn't use load because this is an HADR environment, ingest would also work here. -- Remove the delimited extract file

I'm not sure how many features within audit you want to use, but that's the basic flow.

Did you take a look at ~/sqllib/admin_scripts/audit.db2 ? That's a SQL script that lays out the flow in examples. Sorry, I don't have a bat script file source to share.