Change Data Capture - SQL Server 2008

  • nitesh_rd

    SSC Enthusiast

    Points: 110

    Comments posted to this topic are about the item Change Data Capture - SQL Server 2008

  • Daniel Steiner

    Grasshopper

    Points: 18

    this feature is not available in all editions of SQL Server.

    Change data capture is available only on the Enterprise, Developer, and Evaluation editions of SQL Server.

  • Kishore.P

    SSCrazy Eights

    Points: 8147

    Is it possible to hold the CDC information into another database?. It means for example, I have database name call INVENTORYDB, have enabled the CDC for all tables on this database. But I want capture the CDC from INVENTORYDB into DBAUDITLOG database? If possible, please share the idea.

    Thanks in advance.

  • Divine Flame

    SSCoach

    Points: 15941

    Nice article to start.

    If would have been nice if you had explained few things in a better manner. For example, what is the difference between "All changes" & "Net Changes"?


    Sujeet Singh

  • justdr5

    Grasshopper

    Points: 23

    Does it have the ability to return to a previous state? Ie. If i make data changes at 1pm it has a means for me to revert back to the state at 12:59pm? Also, does it track who/what made the change?

  • Steve Rajkovich

    SSC Rookie

    Points: 33

    Thanks, you have explained some good basics for me to think about...too bad it's not offered in Standard.

    However, how do schema changes on the tblEmployee table impact the CDC's process and data when CDC is enabled for the tblEmployee table? Would you have to disable and re-enabled CDC for the table and basically recreate it? ...and in doing so, are all change data lost?

    How are transactions handled via the CSC when ROLLBACKS are executed?

    You state triggers affect performance...I agree...but WHY does the CDC perform better? Technical detail may be outside of scope of the article, but some comparison workings of the trigger vs. CDC would nice to understand why after starting with the "argument."

  • kapil_kk

    SSC-Insane

    Points: 21316

    WHen you are enabling CDC on table, you are executing a sp in this manner:

    EXEC sys.sp_cdc_enable_table

    @Source_schema = N'dbo',

    @source_name = N'tblEmployee',

    @filegroup_name = N'PRIMARY',

    @supports_net_changes = 1

    GO

    It will not gets executed as it requires other parameters also

    EXEC [sys].[sp_cdc_enable_table]

    (

    @source_schema sysname,

    @source_name sysname,

    @capture_instance sysname = null,

    @supports_net_changes bit = null,

    @role_name sysname,

    @index_name sysname = null,

    @captured_column_list nvarchar(max) = null,

    @filegroup_name sysname = null,

    @allow_partition_switch bit = 1

    )

    Specify parameter @role_name also in your article

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Jim_K

    SSCrazy

    Points: 2363

    A good article to read on CDC is the whitepaper that was published a couple of years ago when the feature was released with 2008. IIRC, CDC does create a schema in the local database, but it gets the changes in data from the transaction logs (which has some side effects). SSIS also can extract the data for loading into a separate database, and you can do it through SQL as well.

  • TimothyAWiseman

    SSCrazy Eights

    Points: 8819

    Thanks for the article, it provides a good summary and overview of CDC.

    It is worth emphasizing that CDC is mostly an enterprise feature and is not available in Standard or Express editions.

    ---
    Timothy A Wiseman
    SQL Blog: http://timothyawiseman.wordpress.com/

  • YSLGuru

    SSC-Insane

    Points: 21495

    Maybe its just me but SQL Servers CDC just feels way to kludgy. Three times now I've tried it out on SQL Server 2008R2 Enterprise and every time its left a sour taste. From its lack of information (who made the change) to the overkill required to get the info CDC has captrured, the feature just has a beta feel to it. I guess if you don't care who made the change and you don't mind the excessive number of steps (i.e. lines of SQL Code) you have to run to get any info then maybe CDC is OK to you.

    What gets me the most is how you can't just call a CDC function with something simple (i.e an as of date or a date range). You have to pass in LSN values and even then you have to be careful to validate them first.

    I personally prefer to NOT do anything custom and use native SQL Server functionality whenever possible but when it comes to Change Data Capture I've had a far easier time with a custom trigger and audit table. I had been so looking forward to CDC when we moved from SQL 200 to 2008R2.

    Kindest Regards,

    Just say No to Facebook!
  • Shadab Shah

    SSCarpal Tunnel

    Points: 4759

    Hi everyone,

    "cdc.dbo_tblEmployee_CT" table got created in SystemTables . And the query

    SELECT Name As DataBaseName, is_cdc_enabled FROM sys.databases Where is_cdc_enabled = 1

    SELECT Name AS TableName, is_tracked_by_cdc FROM sys.tables Where is_tracked_by_cdc = 1

    return the result as expected.

    Evenafter all this when i insert,update or delete any record the table "cdc.dbo_tblEmployee_CT" is not getting updated.

    Could anybody suggest any possible reason for this.

  • JJ B

    SSCarpal Tunnel

    Points: 4571

    I think this is an excellent tutorial. It's just enough to let someone decide if the feature will work for them and to get started if so. Explained very well. Thanks.

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply