Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL SERVER AUDIT


SQL SERVER AUDIT

Author
Message
muth_51
muth_51
Mr or Mrs. 500
Mr or Mrs. 500 (532 reputation)Mr or Mrs. 500 (532 reputation)Mr or Mrs. 500 (532 reputation)Mr or Mrs. 500 (532 reputation)Mr or Mrs. 500 (532 reputation)Mr or Mrs. 500 (532 reputation)Mr or Mrs. 500 (532 reputation)Mr or Mrs. 500 (532 reputation)

Group: General Forum Members
Points: 532 Visits: 2862
We have setup an audit on one of our prod server and collect the audit files on a drive. We have a sql server job which runs every 10 mins and load the audit data from files to a table. The files never get deleted as set by max_rollover_files setting. This causes files to pile up and the job tries to load the data into a table takes too long(7 to 8 hrs) to load the data as it scans all the files in that folder. Whenever we have to delete the files we have to stop the audit for few seconds. If we don't stop and try to delete the files it throws an error saying the files cannot be deleted as they are in use.
Any suggestions???
Bill (DBAOnTheGo)
Bill (DBAOnTheGo)
SSChasing Mays
SSChasing Mays (639 reputation)SSChasing Mays (639 reputation)SSChasing Mays (639 reputation)SSChasing Mays (639 reputation)SSChasing Mays (639 reputation)SSChasing Mays (639 reputation)SSChasing Mays (639 reputation)SSChasing Mays (639 reputation)

Group: General Forum Members
Points: 639 Visits: 585
Have you considered using the script that's reading the files into the table to then move said file to an archive folder? Powershell may help you with this if it's an easier answer.

get-childitem -path "\\srv1\t$\tracefiles\*.trc" | move-item -destination "\\srv1\t$\tracefiles\Archive\"

and just have that be step 2 in the process. Someone step in if you don't mind, I know you can set it to move based off a where... and have it in the load of the files set the archive bit, and then use the powershell script to only move those with the archive bit swapped.


For the issue where the file is in use and cannot delete. If it only reads in files without the archive bit... but sets it at the end, you wouldn't have to worry about the old files being picked up.

This is just for an idea path, I didn't provide a complete solution. :-D

.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search