SQL Server 2008 change data capture vs triggers in audit trail

前端 未结 2 580
轻奢々
轻奢々 2020-12-30 07:32

We have audit trail implemented using triggers on our web application. Those triggers log field level updates. So, in a table, if you have 5 column values changed, we have 5

2条回答
  •  心在旅途
    2020-12-30 08:14

    I use CDC in my WPF app. Works very well but I've discovered three problems:

    • You need to back-up change tables quite often (I use MERGE statement to add records to historical tables). Because record stays in change table only for about 2-3 days as I found out. Don't forget to backup cdc.lsn_time_mapping table.
    • You can't truncate tables with CDC enabled.
    • There is a problem with disabling cdc and reenabling (should be solved in new service pack as MS said). I've got this problem only once so it's not so annoying.

      http://blogs.technet.com/b/claudia_silva/archive/2010/06/04/cdc-cdc-hangs-when-i-try-to-disable-it.aspx

    Anyway, CDC is very useful mechanism which helps me track all changes on database.

提交回复
热议问题