Jump to content

Audit log not getting archived


tester22
 Share

Recommended Posts

Hi,

 

Managed to solve it.

If the archiving service crashes while copyting data from audit to auditarchive tables it creates conflicts and the process crashes.

 

After removing the primarykey from auditarchive the archiving works as expected but I am getting duplicates.

The running:

 

WITH cte AS (SELECT[AuditID], [UserID], 2 row_number() OVER(PARTITION BY AuditID, UserID ORDER BY AuditID) AS [rn] 3 FROM [passwordstate].[dbo].[AuditingArchive] 4 )DELETE cte WHERE [rn] > 1

 

Cleans the table and I could re-enable the primary key in the archiving table.

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...