数据库复制Database replication

适用范围: Configuration Manager (Current Branch)Applies to: Configuration Manager (current branch)

Configuration Manager 数据库复制使用 SQL Server 来传输数据。Configuration Manager database replication uses SQL Server to transfer data. 它使用此方法将其站点数据库中的更改与层次结构中其他站点上的数据库中的信息进行合并。It uses this method to merge changes in its site database with the information from the database at other sites in the hierarchy.

请注意有关数据库复制的以下几点:Note the following points about database replication:

  • 所有站点共享相同的信息。All sites share the same information.

  • 在层次结构中安装站点时,Configuration Manager 将自动在新站点与其父站点之间建立数据库复制。When you install a site in a hierarchy, Configuration Manager automatically establishes database replication between the new site and its parent site.

  • 当站点安装完成后,数据库复制将自动开始。When the site installation finishes, database replication automatically starts.

向层次结构添加新站点时,Configuration Manager 会在该新站点创建通用数据库。When you add a new site to a hierarchy, Configuration Manager creates a generic database at the new site. 父站点在其数据库中创建相关数据的快照。The parent site creates a snapshot of the relevant data in its database. 然后,使用基于文件的复制将快照传输到新站点。It then transfers the snapshot to the new site using file-based replication. 然后,新站点使用 SQL Server 成批复制程序 (BCP) 将信息加载到其 Configuration Manager 数据库的本地副本。The new site then uses the SQL Server Bulk Copy Program (BCP) to load the information into its local copy of the Configuration Manager database. 在快照加载后,每个站点均会与其他站点执行数据库复制。After the snapshot loads, each site conducts database replication with the other site.

为在站点之间复制数据,Configuration Manager 会使用其自己的数据库复制服务。To replicate data between sites, Configuration Manager uses its own database replication service. 数据库复制服务使用 SQL Server 更改跟踪来监视本地站点数据库的变化。The database replication service uses SQL Server change tracking to monitor the local site database for changes. 然后,它使用 SQL Server Service Broker (SSB) 将更改复制到其他站点。It then replicates the changes to other sites by using SQL Server Service Broker (SSB). 默认情况下,此过程使用 TCP 端口 4022。By default, this process uses TCP port 4022.

复制组Replication groups

Configuration Manager 将由数据库复制造成的重复数据划分到不同复制组。Configuration Manager groups data that replicates by database replication into different replication groups. 每个复制组都有一个单独的固定复制计划。Each replication group has a separate, fixed replication schedule. 站点使用此计划来确定将更改复制到其他站点的频率。The site uses this schedule to determine how frequently it replicates changes to other sites.

例如,对基于角色的管理配置的更改会快速复制到其他站点。For example, a change to a role-based administration configuration replicates quickly to other sites. 此行为可确保其他站点可以快速地强制执行这些更改。This behavior makes sure that the other site can quickly enforce these changes. 优先级较低的配置更改(如请求安装新辅助站点),复制的紧迫性会少些。A lower-priority configuration change, such as a request to install a new secondary site, replicates with less urgency. 新站点请求可能需要几分钟才能达到目标主站点。It can take several minutes for a new site request to reach the destination primary site.


对于数据库复制,可以修改以下设置:You can modify the following settings for database replication:

  • 数据库复制链接:控制特定流量何时遍历网络。Database replication links: Control when specific traffic traverses the network.

  • 分布式视图:在管理中心站点 (CAS) 针对选定站点数据发出请求时,它可以从子主站点的数据库中直接访问该数据。Distributed views: When a central administration site (CAS) requests selected site data, it can access the data directly from the database at a child primary site.

  • 计划:指定使用复制链接的情形并指定复制不同类型的站点数据的情形。Schedules: Specify when a replication link is used, and when different types of site data replicate.

  • 摘要:针对遍历复制链接的网络流量更改数据摘要设置。Summarization: Change settings for data summarization about network traffic that traverses replication links. 默认情况下,汇总每 15 分钟发生一次。By default, summarization occurs every 15 minutes. 它用于数据库复制报表。It's used in reports for database replication.

  • 数据库复制阈值:定义站点何时将链接报告为降级或失败。Database replication thresholds: Define when the site reports links as degraded or failed. 还可以配置 Configuration Manager 在何时发出有关复制链接处于降级或失败状态的警报。You can also configure when Configuration Manager raises alerts about replication links that have a degraded or failed status.

数据类型Types of data

Configuration Manager 将它复制的数据主要分为全局数据和站点数据两类 。Configuration Manager primarily classifies the data that it replicates as either global data or site data. 当发生数据库复制时,站点将跨数据库复制链接来传输全局数据和站点数据的更改。When database replication occurs, the site transfers changes to global data and site data across the database replication link. 全局数据复制到父站点或子站点。Global data replicates to a parent or child site. 站点数据仅复制到父站点。Site data replicates only to a parent site. 第三类数据类型(本地数据) 不会复制到其他任何站点。A third data type, local data, doesn't replicate to other sites. 本地数据是指其他站点不需要的信息。Local data is information that other sites don't require.

全局数据Global data

全局数据是管理员创建的对象,这些对象将复制到整个层次结构中的所有站点。Global data is administrator-created objects that replicate to all sites throughout the hierarchy. 辅助站点仅接收作为全局代理数据的全局数据的一个子集。Secondary sites only receive a subset of global data, as global proxy data. 用户在 CAS 和主站点创建全局数据。You create global data at the CAS and primary sites. 此类型包括以下数据:This type includes the following data:

  • 软件部署Software deployments
  • 软件更新Software updates
  • 集合定义Collection definitions
  • 基于角色的管理安全作用域Role-based administration security scopes

站点数据Site data

站点数据是 Configuration Manager 主站点及其分配的客户端创建的操作信息。Site data is operational information created by Configuration Manager primary sites and their assigned clients. 站点数据复制到 CAS,但不复制到其他主站点。Site data replicates to the CAS, but not to other primary sites. 站点数据仅在 CAS 和数据源自的主站点中可见。Site data is only viewable at the CAS and at the primary site where the data originates. 只能修改在创建站点数据的主站点上的站点数据。You can only modify site data at the primary site where you created it. 此类型包括以下数据:This type includes the following data:

  • 硬件清单Hardware inventory
  • 状态消息Status messages
  • 警报Alerts
  • 基于查询的集合的结果The results of query-based collections

所有站点数据都复制到 CAS。All site data replicates to the CAS. CAS 为整个站点层次结构执行管理和报告操作。The CAS does administration and reporting for the entire site hierarchy.

在层次结构中安装新站点时,Configuration Manager 将自动在父站点和新站点之间创建数据库复制链接。When you install a new site in a hierarchy, Configuration Manager automatically creates a database replication link between the parent site and the new site. 它创建单个链接来连接两个站点。It creates a single link to connect the two sites.

若要控制跨复制链接的数据传输,请更改每个链接的设置。To control the transfer of data across the replication link, change settings for each link. 每个复制链接均支持单独的配置。Each replication link supports separate configurations. 每个数据库复制链接都包括以下控件:Each database replication link includes the following controls:

  • 停止将所选站点数据从主站点复制到 CAS。Stop the replication of selected site data from a primary site to the CAS. 此操作可使 CAS 从主站点的数据库中直接访问此数据。This action causes the CAS to access this data directly from the database of the primary site.

  • 计划将选定站点数据从子主站点传输到 CAS。Schedule selected site data to transfer from a child primary site to the CAS.

  • 定义用于确定数据库复制链接处于降级状态或失败状态的设置。Define the settings that determine when a database replication link has a degraded or failed status.

  • 指定何时针对失败的复制链接发出警报。Specify when to raise alerts for a failed replication link.

  • 指定 Configuration Manager 对使用复制链接的复制流量的相关数据进行汇总的频率。Specify how frequently Configuration Manager summarizes data about the replication traffic that uses the replication link. 它在报表中使用此数据。It uses this data in reports.

若要配置数据库复制链接,请在 Configuration Manager 控制台中,转到“监视” 工作区。To configure a database replication link, in the Configuration Manager console, go to the Monitoring workspace. 选择“数据库复制” 节点,然后编辑该链接的属性。Select the Database Replication node, and edit the properties for the link. 此节点也位于“层次结构配置”节点下的“管理”工作区中 。This node is also in the Administration workspace, under the Hierarchy Configuration node. 可以从复制链接的父站点或子站点中编辑复制链接。Edit a replication link from either the parent site or the child site of the replication link.


你可以编辑任一工作区内“数据库复制” 节点中的数据库复制链接。You can edit database replication links from the Database Replication node in either workspace. 不过,在使用“监视” 工作区中的“数据复制” 节点时,还可以查看数据库复制的状态。However, when you use the Database Replication node in the Monitoring workspace, you can also view the status of database replication. 它还提供对复制链接分析器工具的访问。It also provides access to the Replication Link Analyzer tool. 使用此工具可帮助调查数据库复制的问题。Use this tool to help investigate problems with database replication.

有关如何配置复制链接的详细信息,请参阅站点数据库复制控件For more information about how to configure replication links, see Site database replication controls. 有关如何监视复制的详细信息,请参阅监视数据库复制For more information about how to monitor replication, see Monitor database replication.

分布式视图Distributed views

通过分布式视图,当你在 CAS 上针对所选站点数据发出请求时,它会直接访问子主站点上的数据库。Through distributed views, when you make a request at the CAS for selected site data, it directly accesses the database at the child primary site. 此直接访问无需再从主站点将该站点数据复制到 CAS。This direct access replaces the need to replicate site data from the primary site to the CAS. 由于每个复制链接均与其他复制链接无关,因此可在所选的复制链接上启用分布式视图。Because each replication link is independent from other replication links, you can use distributed views on the replication links that you choose. 不能在主站点和辅助站点之间使用分布式视图。You can't use distributed views between a primary site and a secondary site.

分布式视图提供以下好处:Distributed views provide the following benefits:

  • 降低 CPU 负载以在 CAS 和主站点上处理数据库更改Reduce the CPU load to process database changes at the CAS and primary sites

  • 降低跨网络传输到 CAS 的数据量Reduce the amount of data that transfers across the network to the CAS

  • 改善托管 CAS 数据库的 SQL Server 的性能Improve the performance of the SQL Server that hosts the CAS database

  • 减少 CAS 数据库使用的磁盘空间Reduce the disk space used by the CAS database

当主站点在网络上临近 CAS 且两个站点始终启动并始终相连时,考虑使用分布式视图。Consider using distributed views when a primary site is closely located to the CAS on the network, the two sites are always on, and always connected. 分布式视图会将站点间选定数据的复制替换为每个站点上站点数据库服务器之间的直接连接。Distributed views replace the replication of the selected data between the sites with direct connections between the site database servers at each site. 每次请求此数据时,CAS 都会建立直接连接。The CAS makes a direct connection each time you request this data.

在以下示例场景中,站点请求分布式视图数据:The site requests distributed view data in the following example scenarios:

  • 运行报表或查询时When you run reports or queries
  • 在资源浏览器中查看信息时When you view information in Resource Explorer
  • 对包含基于站点数据的规则的集合进行集合评估时Collection evaluation for collections that include site data-based rules

默认情况下,每个复制链接均已关闭分布式视图。By default, distributed views are turned off for each replication link. 启用分布式视图时,选择不会跨该链接复制到 CAS 的站点数据。When you turn on distributed views, you select site data that won't replicate to the CAS across that link. CAS 会从共享该链接的子主站点数据库直接访问此数据。The CAS accesses this data directly from the database of the child primary site that shares the link. 你可以为分布式视图配置以下类型的站点数据:You can configure the following types of site data for distributed views:

  • 来自客户端的硬件清单数据 Hardware inventory data from clients
  • 来自客户端的软件清单和软件计数数据 Software inventory and software metering data from clients
  • 来自客户端、主站点和所有辅助站点的状态消息 Status messages from clients, the primary site, and all secondary sites

在 Configuration Manager 控制台或报表中查看数据时,从操作方面来说,分布式视图对于你不可见。When you view data in the Configuration Manager console or in reports, distributed views are operationally invisible to you. 当你请求针对分布式视图启用的数据时,CAS 站点数据库服务器会直接访问子主站点的数据库以检索信息。When you request data that's enabled for distributed views, the CAS site database server directly accesses the child primary site's database to retrieve the information.

例如,使用连接到 CAS 的 Configuration Manager 控制台。For example, you use a Configuration Manager console connected to the CAS. 从两个主站点请求有关硬件清单的信息:ABC 和 XYZ。You request information about hardware inventory from two primary sites: ABC and XYZ. 仅为站点 ABC 上的分布式视图启用硬件清单。You only enabled hardware inventory for distributed views at site ABC. CAS 从其自己的数据库中检索 XYZ 客户端的清单信息。The CAS retrieves inventory information for XYZ clients from its own database. CAS 直接从站点 ABC 的数据库中检索 ABC 客户端的清单信息。The CAS retrieves inventory information for ABC clients directly from the database at site ABC. 此信息将出现在 Configuration Manager 控制台或报表中,但不标识信息源。This information appears in the Configuration Manager console or in a report without identifying the source.

如果复制链接具有一类已对分布式视图启用的数据,子主站点就不会将该数据复制到 CAS。If a replication link has a type of data enabled for distributed views, the child primary site doesn't replicate that data to the CAS. 关闭某类数据的分布式视图后,子主站点会恢复到 CAS 的正常数据复制。When you turn off distributed views for a type of data, the child primary site resumes normal data replication to the CAS. 必须先在主站点和 CAS 之间将包含此数据的复制组重新初始化,CAS 上才会提供此数据。Before this data is available at the CAS, the replication groups for this data must reinitialize between the primary site and the CAS. 卸载已启用分布式视图的主站点后,CAS 必须先完成其数据的重新初始化,然后才能在 CAS 上访问已对分布式视图启用的数据。After you uninstall a primary site that has distributed views turned on, the CAS must complete reinitialization of its data before you can access data that you enabled for distributed views on the CAS.


在站点层次结构中的任何复制链接上使用分布式视图时,在卸载任何主站点之前,先关闭所有复制链接的分布式视图。When you use distributed views on any replication link in the site hierarchy, before you uninstall any primary site, turn off distributed views for all replication links. 有关详细信息,请参阅卸载使用分布式视图的主站点For more information, see Uninstall a primary site that uses distributed views.

分布式视图的先决条件和限制Prerequisites and limitations for distributed views

  • 只能在 CAS 和主站点之间的复制链接上使用分布式视图。Only use distributed views on replication links between the CAS and a primary site.

  • CAS 必须使用 SQL Server 企业版。The CAS must use SQL Server Enterprise edition. 主站点没有此要求。The primary site doesn't have this requirement.

  • CAS 只能拥有 SMS 提供程序的一个实例。The CAS can have only one instance of the SMS Provider. 在站点数据库服务器上安装单个实例。Install that single instance on the site database server. 此配置支持 Kerberos 身份验证。This configuration supports Kerberos authentication. CAS 上的 SQL Server 要求使用 Kerberos 访问子主站点的 SQL Server。The SQL Server at the CAS requires Kerberos to access the SQL Server at the child primary site. 对于子主站点上的 SMS 提供程序没有任何限制。There are no limitations on the SMS Provider at the child primary site.

  • 只能在 CAS 上安装一个 Reporting Services 点。You can only install one reporting services point at the CAS. 在站点数据库服务器上安装 SQL Server Reporting Services。Install SQL Server Reporting Services on the site database server. 此配置支持 Kerberos 身份验证。This configuration supports Kerberos authentication. CAS 上的 SQL Server 要求使用 Kerberos 访问子主站点的 SQL Server。The SQL Server at the CAS requires Kerberos to access the SQL Server at the child primary site.

  • 无法在 SQL Server Always On 故障转移群集实例上托管站点数据库。You can't host the site database on a SQL Server Always On failover cluster instance.

  • CAS 数据库服务器的计算机帐户需要对主站点数据库具有读取权限****。The computer account of the CAS database server requires Read permissions on the primary site database.


对于数据库复制链接而言,分布式视图和数据复制时间计划是相互排斥的设置。Distributed views and schedules for when data can replicate are mutually exclusive settings for a database replication link.

计划站点数据的传输Schedule transfers of site data

为了帮助你控制将站点数据从子主站点复制到 CAS 时所用的网络带宽,请计划使用复制链接的时间。To help you control the network bandwidth that's used to replicate site data from a child primary site to the CAS, schedule when a replication link is used. 然后,指定复制不同类型的站点数据的时间。Then specify when different types of site data replicate. 你可以控制主站点复制状态消息、清单和计数数据的时间。You can control when the primary site replicates status messages, inventory, and metering data. 辅助站点中的数据库复制链接不支持站点数据计划。Database replication links from secondary sites don't support schedules for site data. 无法计划全局数据传输。You can't schedule the transfer of global data.

配置数据库复制链接计划时,可以限制所选站点数据从主站点到 CAS 的传输。When you configure a database replication link schedule, you can restrict the transfer of selected site data from the primary site to the CAS. 还可以配置不同的时间来复制不同类型的站点数据。You can also configure different times to replicate different types of site data.


对于数据库复制链接而言,分布式视图和数据复制时间计划是相互排斥的配置。Distributed views and schedules for when data can replicate are mutually exclusive configurations for a database replication link.

流量摘要Summarization of traffic

每个站点会定期汇总关于遍历站点数据库复制链接的网络流量的数据。Each site periodically summarizes data about the network traffic that traverses database replication links for the site. 站点将汇总数据用于数据库复制报表。The site uses summarized data in reports for database replication. 复制链接上的两个站点都汇总遍历复制链接的网络流量Both sites on a replication link summarize the network traffic that traverses the replication link. 站点数据库服务器汇总数据。The site database server summarizes the data. 汇总数据后,此信息会作为全局数据复制到其他站点。After it summarizes data, the information replicates to other sites as global data.

默认情况下,汇总每 15 分钟发生一次。By default, summarization occurs every 15 minutes. 若要修改网络流量汇总的频率,可在数据库复制链接属性中编辑“摘要间隔”****。To modify the frequency of summarization for network traffic, in the properties of the database replication link, edit the Summarization interval. 汇总频率会影响你在报表中查看的关于数据库复制的信息。The frequency of summarization affects the information that you view in reports about database replication. 可以选择 5 到 60 分钟的间隔。You can choose an interval from 5 to 60 minutes. 如果增加汇总频率,则会增加复制链接上每个站点中 SQL Server 的处理负荷。When you increase the frequency of summarization, you increase the processing load on the SQL Server at each site on the replication link.

数据库复制阈值Database replication thresholds

数据库复制阈值定义 Configuration Manager 将数据库复制链接状态报告为降级或失败的时间。Database replication thresholds define when Configuration Manager reports the status of a database replication link as either degraded or failed. 默认情况下,如果任何一个复制组在 12 次连续尝试后无法完成复制,则将链接设置为降级**。By default, it sets a link as degraded when any one replication group fails to complete replication for 12 consecutive attempts. 如果任何一个复制组在 24 次连续尝试期间无法完成复制,则将链接设置为失败**。It sets the link as failed when any replication group fails to replicate in 24 consecutive attempts.

可以为降级或失败状态指定自定义值。You can specify custom values for degraded or failed status. 如果调整这些值,可以更准确地监视跨链接进行的数据库复制的运行状况。If you adjust these values, you can more accurately monitor the health of database replication across the links.

一个或多个复制组可能无法复制,而其他复制组可以继续成功复制。One or more replication groups can fail to replicate while other replication groups continue to successfully replicate. 计划在首次报告降级时查看链接的复制状态。Plan to review the replication status of a link when it first reports as degraded.

在以下情况下,请考虑修改链接的降级或失败状态的重试值:Consider modifying the retry values for the degraded or failed status of the link in the following situations:

  • 特定复制组存在重复延迟,其延迟不是问题There are recurring delays for specific replication groups, and their delay isn't a problem

  • 站点之间的网络链接具有低可用带宽The network link between sites has low available bandwidth

如果站点将链接设置为降级或失败之前增加重试次数,则可以消除已知问题的假警告。When you increase the number of retries before the site sets the link to degraded or failed, you can eliminate false warnings for known issues. 此操作可让用户更加准确地跟踪链接的状态。This action lets you more accurately track the status of the link.

若要了解该组复制发生的频率,请考虑每个复制组的复制同步间隔。To understand how frequently replication of that group occurs, consider the replication sync interval for each replication group. 若要查看复制组的同步间隔****,请转到 Configuration Manager 控制台的“监视”**** 工作区。To view the Synchronization Interval for replication groups, go to the Monitoring workspace in the Configuration Manager console. 在“数据库复制”**** 节点中,选择复制链接的“复制详细信息”**** 选项卡。In the Database Replication node, select the Replication Detail tab of a replication link.

有关如何监视数据库复制(包括如何查看复制状态)的详细信息,请参阅监视数据库复制For more information about how to monitor database replication, including how to view the replication status, see Monitor database replication.

站点数据库复制控件Site database replication controls

可更改每个站点数据库的设置,帮助你控制用于数据库复制的网络带宽。To help you control the network bandwidth used for database replication, change the settings for each site database. 这些设置仅适用于在其中配置设置的站点数据库。The settings apply only to the site database in which you configure the settings. 站点通过数据库将任何数据复制到任何其他站点时,会始终使用这些设置。The settings are always used when the site replicates any data by database replication to any other site.

可以为每个站点数据库修改以下复制控件:You can modify the following replication controls for each site database:

  • SSB 端口The SSB port

  • 在复制失败触发站点重新初始化其站点数据库副本之前等待的时间段The period of time to wait before replication failures trigger the site to reinitialize its copy of the site database

  • 压缩站点复制的数据。Compress the data that a site replicates. 只会为站点之间的传输压缩数据,而不会为任一站点上站点数据库中的存储压缩数据。It only compresses the data for transfer between sites, and not for storage in the site database at either site.

若要更改站点数据库复制控件的设置,请在 Configuration Manager 控制台中的“数据库复制”**** 节点上,编辑该站点数据库的属性。To change the settings for the replication controls for a site database, in the Configuration Manager console, on the Database Replication node, edit the properties of the site database. 此节点出现在“管理”工作区中的“层次结构配置”节点下面,也出现在“监视工作区”中。This node appears under the Hierarchy Configuration node in the Administration workspace, and also appears in the Monitoring workspace. 若要编辑站点数据库的属性,请选择站点之间的复制链接,然后打开“父数据库属性”**** 或“子数据库属性”****。To edit the properties of the site database, select the replication link between the sites, and then open either Parent Database Properties or Child Database Properties.


你可以配置任一工作区内“数据库复制”**** 节点中的数据库复制控件。You can configure database replication controls from the Database Replication node in either workspace. 但是,如果使用“监视”工作区内的“数据库复制”节点,则也可以查看复制链接的数据库复制状态,并且可以访问复制链接分析器工具以帮助你调查复制问题。However, when you use the Database Replication node in the Monitoring workspace, you can also view the status of database replication for a replication link, and access the Replication Link Analyzer tool to help you investigate problems with replication.

另请参阅See also

监视复制Monitor replication

SQL Server 复制故障排除Troubleshoot SQL Server replication