知方可补不足~用CDC功能来对数据库变更进行捕捉

回到目录

如果我们希望监视一个数据表的变化,在sql2008之前的版本里,在数据库端可能想到的只有触发器,或者在程序端通过监视自己的insert,update,delete来实现相应的功能,这种实现无疑是让我们感到恐惧的,不够灵活的,而当进行sql2008后,这种情况得到了本质的改变,sql2008为我们提供了CDC功能,它可以实时对指定的数据表进行监控,当前它同时对产生SQL的一些负载。

CDC工作流程

CDC功能主要捕获SQLServer指定表的增删改操作,由于任何操作都会写日志(哪怕truncate),所以CDC的捕获来源于日志文件。日志文件 会把更改应用到数据文件中,同时也会标记符合要求的数据标记为需要添加跟踪的项。然后通过一些配套函数,最后写入到数据仓库中。

CDC实现步骤

第一步、对目标库显式启用CDC:

在当前库使用sys.sp_cdc_enable_db。返回0(成功)或1(失败)。注意,无法对系统数据库和分发数据库启用该功能。且执行者需要用sysadmin角色权限。

该存储过程的作用域是整个目标库。包含元数据、DDL触发器、cdc架构和cdc用户。

使用以下代码启用:

USE tableName

Go

EXECUTE sys.sp_cdc_enable_db

GO

当设置好数据库的CDC功能后,我们可以查看一下是否已经设置成功

SELECT  IS_CDC_ENABLED ,
CASE WHEN IS_CDC_ENABLED = 0 THEN 'CDC功能禁用'
ELSE 'CDC功能启用'
END 描述
FROM SYS.DATABASES
WHERE NAME = 'tableName'

同时,数据库的用户将会多了一个CDC用户

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUoAAAFRCAIAAACdWnMKAAAgAElEQVR4nO2de3RV1b3vc0/PGKe9nrbDHtvTa7Eej+2xvVrUVo88gxGxCBGpPBMBBQyPgIC8FFDkEQIhQCIhAUECCYQQE2KU8MagaLRAAgGBoOEhIIGQAAFCQuZjrfvHPt13s1577fWac8/9+4wMxtpzz8dvbeZ3/daac/7WjJJNM0sfdeal86c2nsm9XDn+3PbuNcX//W3BI0dyfv/1iv/YveT+4rn3Fc78dcGMe9ZMvTfrjd8+0OZXei1GRUVFRUUFfvT/q5kYdSeBGRT5NdtSfGvQkOYBAP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1LPN7fW9GWGXnrpQT6f9lQ2AY2wM05YBOue4mX8d7m5aSQlqaAjT+qm9b7BcB7A3bgupd4H+/tIyTvHZiuly3ozbyZekDeQKhw3Us83t/bT1B5q78N6aMciryDXhEAQA9xeomD8d5mXHSg6tQPw0GfsaP00azHuDkA0AR6CQAIC8gbAIQF5A0AwgLyBgBhEUreduK9Qx2sgnFsgH/E6Zf24701V7PojVQHnfoCAOZw3Sm9399bgfkJLVvnCQDuwHW/ZBXv7cdAt3BzDvAP1/3Sy3hvM3fgel+BvAE+4bpfeh/vrXdgkNk4GwAwhOt+6XG8t8EKUONRN3gCB/iE6x7pcby3Ze8dNDMAMIHrHunx/t6BLlrdqGZm4xQAYAvXPdLjeO/Am3B/ip5tIG+Af7jukR7He9sZWgNtAxwiTqd0Kt7b5LAZ6BngH+ijACAsIG8AEBaQNwAIC8gbAIRFKHk7tb+3AoNxtaADbHoZYGQO8ABxOpmD+3srUK9RVX8VmGJm4aqiICxuBdyA657Edn/vwK/0PqpLBRW/umDQUgBgDa57EvP9vTUFb+CBDaoyzgnyBtyA657Edn9v9UeD22y1PtVXAT23r1czANiE657kZby3gf8M6aN8p7yDXgWCtg4AluG6JzGJ9zbpdWVDGSsyB33GBnkDbsB1T2IS721wmy3fGVUWVNh656Upe7g5BxyH657kcby3rPKcxjfYBvLWq1DvK/DegBtw3ZO8j/eWtdRlRvOaBwbHinpA3oAbcN2TmMd7W/gohyLvoFcEALDD/wPW/lOvr5H5nAAAAABJRU5ErkJggg==" alt="" />

第二步、对目标表启用CDC

使用db_owner角色的成员执行sys.sp_cdc_enable_table为每个需要跟踪的表创建捕获实例。然后通过sys.tables目录视图中的is_tracked_by_cdc列来判断是否创建成功。

默认情况下会对表的全部列做捕获。如果只需要对某些列做捕获,可以使用@captured_column_list参数指定这些列。

如果要把更改表放到文件组里的话,最好创建单独的文件组(最起码与源表独立)。

EXEC sys.sp_cdc_enable_table @source_schema = 'DBO',
@source_name = 'WebManageUsers', @role_name = NULL

注意,source_schema说的是数据库架构者,如dbo,cdc等

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAToAAAEnCAIAAAC2aBhOAAAYiUlEQVR4nO2de3AVVZ7H8//U1lZtzc5OTbk7O7u1u7WlVW7t6kB4jCLIQxwWhCxOhDA8MyIawiBKcFAmPOSZFJEQiESNQIxBBAmvgIElMBg2CAghPEIIBsEEko3ySHLO6dP7R9ZMuN19bt++j+5f9/dTt271Pfc8c35fTnff86WT9B946623eo6TkpJM03soWPNGZ9se/m2h+GYdb/gjq51z90T63WOp7QefvV0+qLns8abND9fnP1S64Mf9/uMRY3FjK8aPPSk96Um9sKoTAB8TRpZW6etWzL9/u7RHqx2nX7x7LLW98j97tHp148/rcv/6vXk/e+Sff27Ztm25GnVrZ2wA+IwH5GqFsdjaZfParxa3nMz4et/wy9t/ebH0ka8++KfjBX9/cM3Pt2f/bdnCn5Yu+PF7836Wn/l3v3joJ5ZtY3UFIBIcxn3O4rlL5r80b9ak6RNGjx056Mnkf3v0X//hFw/95G/+6i+ML8u2e6nOVIRWeoZcQTBB3ANABsgVADJArgCQAXIFgAzO5bptc07vl/Me2LtvpMgW9g4zAP7AYWRv25xz+/pnnW17Otv23L9deufa2rgqNuQXHXVxyBX4FYe/u4YsraXvryrZtKJk04oPNy79cOPS99dl97zMWw1HSGbTY2OiWtUAUMfhrqZtm3O62it7Xp3fl/PWMn57i/hmnbi6QtQv6NmWOD9jikmrSgVG+m3vbU/YSgF8jEO5lmxa0dVe2X0y3NH+g1C/XinqF7Czr3TUTLlTNa794LOnNvzUVK4P9MD6FDfsV6abEyFU4FccyvXDjUt75PqAVmvndNRM6d7rf7P0seM5P5o55b9MWrV9Mhz2W91CtAD4j1C5GoVhKtf31mV3tVd2r6v820KjVlt3DWza/PChFT964bnhquZt3yVSXLXarwQA0jhcXd9bl93Ztoe3lnVrNcRD17prYHPZ418X/WP5H//ymaf6WbYdbpNwpF/h2hX4G4dyjZXftbeuTNUb9mzZWBBCBX7FTb/r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kBjTj2FdsgAkAGIxl3i/q6ksoVXgCsTCLhq/q27v4YvGxdPUtROzIQFgG2JhFxO/qzHFjs3VVOcAJBJiYReN31WxciouTU1L6WZLLgDxhljAReN3xfIIqEMsaqN8vitu6gLSEAtcPN8VBBl6cnX2fFcAfAAxuQIQZIjJVe13dbt3AMQXenJ17HcFgDrE5Aq/KwgyxOTq2O+q2NmfZEFIQWM9vVN0w8YJq80Ypo0q2jKmK4ZmmmL1lWkexSiA6xCbjCj9rkmGnUnqA9PANeaxI1d1nTbbUo/Ifp+djQK4DrHJiNLvapRrSIibfgw5th/oVv86mKZYtWUUof067XTe2JB6FMBFiM1E9H7XkI+mURtWriF5jIFuqrF4yFU3E5hVHmO3HYwCuAixmYjG76pb6EcRoIrV1fRjPOSqGwSpHprj1dXmKICLEJuJ6P2uxo9Wy6mulJBuFuLGtUu97sVQrsY+mDakHqmdUQAXITYN0fhddWs1xkOuihrU9dvpmKKUzXocjwK4CLFpcOx3TXqQ3in6g4uYUbEhy6+6hp703vkV9VhVblq/elzqPpu2a9V/q1EAdyE2B755visADqAnV9LPd40S04URBAdi8w2/Kwgy9OQKvysILMTkCkCQISZX+F1BkKEnV/hdQWAhJlf4XUGQISZXPN8VBBlicvXI810BcAVicvXI810BcAWScnXmdzXukg05NuYBwFMQC8qYPN/VmGI8AMCDEIvOeDzfNUSiWFqBZyEWl1H6Xbsxes3UeQDwCMSCMh7Pdw2bBwCPQCwoY+53hSwBIYgFawz9rlhCATmIxSv8riDI0JMr/K4gsBCTKwBB5v8ATOjFFlN0ZQ0AAAAASUVORK5CYII=" alt="" />

@source_name说的就是数据表名,@role_name是角色名,为null表示对角色没有特别限制

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAARoAAADDCAIAAADSl0m+AAAOqklEQVR4nO2df2xVZxnHr/5lshgTs81lYSIumpiRqJFNN93cphiiI1uEmMBmSLooWqtjMKsMNBuFmpWOLrgitGBZAaE/LMiPrswWkMFA1gUZY7K12tBLSykFqrT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b1Dv5wLECIvQkfHjFHnf/QIaA35perYRjTpNYOUPDwEUAuAA5AWAMyAkAY0BOABiDgZxQ7wS4wENOqHcCLGBw3wn1TjoeSm9fgpBh8FQE6p10CBIgMEWUcrIfeNQ7BQRyigNs5IR6J9X82bfihji5q4cql4AO0cgpMREL9U653KB9FnWr2gnAFWbZCfVOmta9jnIEC1H5g4GcUO9E2CIi9fSRCBTlgyjlpNNuod6J/BUktqgCF0cRu0JsBzpEICfUO3mFljqIDzg2PEDGYAEODwDGgJwAMAbkBIAxICcAjMFATqh3AlzgISfUOwEWMLjvxLTeycIt0ckHg6ci+NY7qT7StAjYweCZPb71Tl4NGRkLIoSNnNjVO9EdxAfn9D3EOWRsiUZOiYlY+VjvJPbUN6qaQcyTUFSsYJadGNU7EW645kZpB3tCU00FooWBnFjXO4mdVSdpxOTSt5BTDGFwZY9vvZPKFuEe4RKyU/yJQE6TvN4JAshjcGjDQ3WaB/IGHF0AjAE5AWCM/wLItnTQo2ebwAAAAABJRU5ErkJggg==" alt="" />

当设置完成数据表的CDC功能后,我们看一下是否已经配置成功,用下面代码

SELECT  NAME ,
IS_TRACKED_BY_CDC ,
CASE WHEN IS_TRACKED_BY_CDC = 0 THEN 'CDC功能禁用'
ELSE 'CDC功能启用'
END 描述
FROM SYS.TABLES
WHERE OBJECT_ID IN ( OBJECT_ID('DBO.WebManageUsers') )

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXkAAAAqCAIAAADZDLyHAAAHOklEQVR4nO2dTZKyPBDH+0JYrF15BaviFWbvQtzODXRh4SVmNxZncGlZ7jwMzwIInaQTMnyZ8PS/uuYRaCCm6R+dwOsLGxaLxZpeUE6mzWYz3cEXL+69oMThKAd3ApRl+XrcR7fv72/ZsimOv2zj3gvKOBxaJzBrlmPce0EZh+PFrFmqce8FZe5wAID2wfEZrzHXh2wRsuZ3n0Jy/EWLq30ht162oG0FAHFqdv85rgAq/2oT0u7y+XjM0Xuyu1AP2L77VYAuceroOi0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h/4BPWmoOGpfUVAAAAAASUVORK5CYII=" alt="" />

当我们对WebManageUsers表修改数据后,可以在DBO_WebManageUsers_CT表中查到相应的结果,从表名中可以看到,CDC表的命名规则是架构名_表名_CT,呵呵。

SELECT * FROM cdc.DBO_WebManageUsers_CT

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABDkAAABSCAIAAADRkJjJAAAd50lEQVR4nO1dvW7cuBrlC9kwMFWmyisYGDdpbqc+heMyeQNPYdiYzsViK1dJoNrbGespjIWBFAMXQTpji3WXjreQRPFflChKJHUODgxZI1H8fkjxiNQMeX56AEEQBEEQBEEQjI2EpoPZnQWCIAiCIAiC4GQks9fAne/fv5+9DiAIgiAIgiAITsOUtMqXL1/mntpxwuyOAkEQBEEQBMEMmJhWSWJqJYlKgiAIgiAIgmDk1GiVYrfXclXInLiuWq1yf39/f3//VcTt7R8z+rSa/5mxAiAIgiAIgiCYAfVaZbenNXe0MNCuVQghln+HUatVdru9tATr9fW12O1m9Gkq8z8gCIIgCIIgGDOd5lXUGZVVsV+tvLQKMcNUpl2rvL297f+l+3/pn3//VxTQKiAIgiAIgiCYNjXCgJ+peHx8ZNv39/fVxu/fv3e7/WpVGAtt9IZFivCaxLQt0aJVfvz4sd/vHx8f//z7v91u76lVLHVwmSCCVgFBEARBEARBf3ZoFaZPKKVfv36thMrb29tut3/37p2+xC41wvaMNa+y2++/fv262+1vb/+o2EurqBXWbrjXFloFBEEQBEEQBP2pGWrf3v7x48ePx8fHexGVHqjeXLdrFXUQr9UqndsSHd9X+fPv/+oJlv1+t9+/vLx0e0EUJ/xfe62gVUAQBEEQBEEwEPVaRTuvstvt397eqtdCbm//MGmVulzDjAR/wFjzKr9+/Xp9fX19fd3v6Z9///fn3//xdV6tChe5oq38sNpCq4AgCIIgCIKgP13XgP3+/fvr16/s/XW7VrHoDZ/jTVrl5eVFmPzZ7yuZQnfFbrd/fHy0yJVO+WSvIbQKCIIgCIIgCAaiZqh9fX293++roT97FaT6y94J2e12nW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/caHw84xtkE8alG3d/wY9i2idWfCFpl8Lm6j4RzlcJ7m2ZzzjxaxW6J5IHSolVMnuH7Q/MasOS0SvvjKoQQQoJ8D5jwps+WW3lXFuobVJyPA+2Ru9aD/HMWoaukq0RdkTZbymK8a42oVX4etqv2+4vpX63v+C815r1Z3Gr2zKtVkJCaJJkiIdt/Obu0WLpWCZOi7v6PBy4uSsIQH/hoFXWnumEvp/prTh5olSGjYdMppiOloiwlW2BT/mJo2R5OVlT/r6XRs8+58kfKuWrhfU2z+MfFh9pjLA1HGyY5ggf9FxRzHzbmHkxaResZ1hKVW4Hq1uS0yijE79ZnAKNWSZZIyHSxkNgtxEwfwEU0zHcWS+Nd9hEDv2dYtU1INKY+8yqmIawpUi5RkI7xNCF1eM56uUeQKNJR+lQbXCVS8iPJyB+4QKsAsQBaBYgHC4ndQsz0AVxEnZ8ZOw5e+456e42GXZBoTD2f3FOr5KBuUbCPs31MSB1TrgGTtrWSxr0aSQBaBYgF0CpAPFhI7BZipg/gIpqdExI1J9Fq88jABBMyNi0GzKNVvgQAtErqgFYB4sFCYrcQM30AF9HsnJCoOYlWm0cGJpiQsWkxYAat8j4YkCtJA1oFiAcLid1CzPQBXESzc0Ki5iRabR4ZmGBCxqbFgGm0yv8BxupdIi2TWXkAAAAASUVORK5CYII=" alt="" />

从结果中我们可以看到,CDC对于update操作是进行了修改前和修改后的两次捕捉,非常清晰!

 
好了,对于数据库的CDC功能今天就说到这里,希望对各位有所帮助!
上一篇:js 控制表单提交


下一篇:Entity Framework 学习整理