Publication的 immediate_sync 属性


Publication的属性 immediate_sync 控制 Snapshot 文件的创建,如果属性 immediate_sync设置为true,那么snapshot file在snapshot agent 每次 run的时候都会创建。如果设置为false,snapshot file 只在subscription创建时才会创建。在创建Snapshot file之后,如果对article 进行update,会产生 pending transaction,这些transaction会被写入到distribution db中。如果immediate_sync设置为true,那么replication 会保持 pending transaction,不会因为transaction被replcated而删除,优点是snapshot file 和 pending transaction 能被多个subscription重用,缺点是会导致distribution db增长。pending transaction的maximum retention time是由Publication的Retention属性确定的,Default值是336hours, 即14days。如果immediate_sync属性设置为false,那么在将pending transaction推送到subscriptions之后,replication 将pending transaction 和 snapshot file删除。引用《SQL Server “Distribution clean up: distribution” Job Failing Large MSRepl_commands》:distribution size增长,会导致distribution latency,推荐将immediate_sync属性设置为false。在每次新建subscriber database时,使用新的snapshot。如果要将Publication的immediate_sync设置为false,前提条件 allow_anonymous 必须是false。allow_anonymous:Anonymous subscriptions can be created for the given publication, andimmediate_sync must also betrue.使用以下脚本批量更新publicationAppendix:一,sp_addpublication 重要参数
[@immediate_sync=]immediate_synchronizationSpecifies if the synchronization files for the publication are created each time the Snapshot Agent runs.immediate_synchronization isnvarchar(5), with a default of FALSE.Iftrue, the synchronization files are created or re-created each time the Snapshot Agent runs. Subscribers are able to get the synchronization files immediately if the Snapshot Agent has completed before the subscription is created. New subscriptions get the newest synchronization files generated by the most recent execution of the Snapshot Agent.independent_agent must betrueforimmediate_synchronization to betrue.Iffalse, the synchronization files are created only if there are new su免费云主机域名bscriptions. You must callsp_addsubscriptionfor each subscription when you incrementally add a new article to an existing publication. Subscribers cannot receive the synchronization files after the subscription until the Snapshot Agents are started and completed.[@independent_agent=]independent_agentSpecifies if there is a stand-alone Distribution Agent for this publication.independent_agent isnvarchar(5), with a default of FALSE.Iftrue, there is a stand-alone Distribution Agent for this publication.Iffalse, the publication uses a shared Distribution Agent, and each Publisher database/Subscriber database pair has a single, shared Agent.[@retention=]retentionIs the retention period in hours for subscription activity.retention isint, with a default of 336 hours.If a subscription is not active within the retention period, it expires and is removed.The value can be greater than the maximum retention period of the distribution database used by the Publisher.If0, well-known subscriptions to the publication will never expire and be removed by the Expired Subscription Cleanup Agent.二,引用文档:What Immediate_sync means in Transactional Replicationsp_addpublicationparameter: [ @immediate_sync=] ‘immediate_synchronization’Immediate_syncfeature instructs Replication to maintain Snapshot BCP files and distributed transactions in the Distribution database should a new subscriber be created (or reinit) within the Retention period.By default, this information is purged as soon as existing subscribers receive the transactions.By keeping the Snapshot and transactions for hours or days, new subscribers can 1) Use old snapshot files, and 2) apply all pending changes since the snapshot. New Subscribers (or reinit) would not need to have a “fresh” snapshot generated.IF TRUE (keepcommands CACHED in Distribution database)Iftrue, the synchronization files are created or re-created each time the Snapshot Agent runs. Subscribers are able to get the synchronization files immediately if the Snapshot Agent has completed before the subscription is created. New subscriptions get the newest synchronization files generated by the most recent execution of the Snapshot Agent. Subscribers would then receive any “pending” transactions from the Distribution database.If the publication has the property @immediate_sync set to “trueafterthe Snapshot Agent is created, transactions on the distribution database are maintained only to support the existing subscribers. In other words, at the time of the Snapshot generation completes all subscriptions to be initialized must be known. If a new subscriber is added, or marked for re-initialization after the Snapshot is Generated another snapshot is required.Iftrue, TheDistribution Cleanup Agentwill not purge the Distribution database or the Snapshot folder until the Publication Retention Period. This may result in unexpected distribution database growth.IF FALSE (clean up CACHED commands as soon as Replicated)Iffalse, the synchronization files are created only if there are new subscriptions. Subscribers cannot receive the synchronization files until the Snapshot Agents are started and completed.With immediate_sync was set to “false”, if you then mark ALL subscriptions for re-initialization, they can all apply the same Snapshot.

相关推荐: 网络安全审计介绍与部署实施

审计起源于财务管理,用于审核企业经营行为是否合法,审计从财务入手,也就是审核账务。把审计的概念引申到网络中可以追溯到IDS(***检测系统)研究的早期。最初是对主机日志的审计,发现***行为,后来发展成主机IDS技术【IDS技术可分为主机IDS和网络IDS】。…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 02/01 09:04
下一篇 02/01 09:04