230 likes | 490 Views
CDC+SSIS = SCD. Patrick LeBlanc, SQL Server MVP. #49 Orlando. Contact Information. Email: pleblanc@pragmaticworks.com Twitter: patrickdba Blog: http://bidn.com/blogs/patrickleblanc. Overview. A Few Warehouse Terms Detecting Change Data (OLD SCHOOL) Change Data Capture
E N D
CDC+SSIS = SCD Patrick LeBlanc, SQL Server MVP #49 Orlando
Contact Information • Email: pleblanc@pragmaticworks.com • Twitter: patrickdba • Blog: http://bidn.com/blogs/patrickleblanc
Overview • A Few Warehouse Terms • Detecting Change Data (OLD SCHOOL) • Change Data Capture • SQL Server Integration Service • Slowly Changing Dimension
Warehouse Terms • Data Warehouse • Centralized repository of data. • Organized for analytics and reporting • Dimension • Mechanism for slicing or categorizing data. • Enables filtering and grouping of DW data. • Slowly Changing Dimension (SCD) • Type 0 (Fixed Attribute) • Type I (Changing Attribute) • Type II (Historical Attribute)
Type 1 (Changing Attribute) Update Simple UPDATE statement applied: UPDATE DimCustomer Set AddressLine1 = ‘123 Main St’, ZipCode = ‘54276’ WHERE CustomerID = 5000017302
Type 2 (Changing Attribute) Update
Type 0 (Fixed Attribute) Update Update Ignored or Failure
Old School Change Detection DEMO TIME Create tables with RowVersion column Create table to track RowVersion Build SSIS Package
Key CDC Components • Change Tracking Tables • Based on schema of tracked table • Copy of “before” and “after” data for each record changed • Log Reader Job • Near real-time capture of transactions • Same internal code as Transactional Replication • Transactions tracked by LSN • Clean Up Job • Purges tracking tables of data older then 72 hours (3 days) • CDC Created Functions • sys.sp_cdc_help_change_data_capture • cdc.fn_cdc_get_all_changes_Sales_SalesOrderDetai • cdc.fn_cdc_get_net_changes
New School Change Detection DEMO TIME • Enable Database for CDC • Enable Tables for CDC • Update User Tables • CDC Records LSN and matching Data • Query Changes in _CT Tables based on LSNs
Use CDC + SSIS • Extract • Transform • Load • To Data Warehouse DEMO TIME
Biography • BI Architect for Pragmatic Works • SQL Server MVP • Decade of SQL Server Experience • Founder SQL Lunch (www.sqllunch.com) • Leader Baton Rouge, LA SQL Server User Group • Twitter:@patrickdba • Blog: http://www.bidn.com/blogs/PatrickLeBlanc • Author: Knight’s Microsoft Business Intelligence 24-Hour Trainer
? Questions
Contact Information • Email: pleblanc@pragmaticworks.com • Twitter: patrickdba • Blog: http://bidn.com/blogs/patrickleblanc
@ SQL Saturday #49 Orlando CDC+SSIS = CDC Patrick Leblanc (blog|twitter)