sql加载配置文件时出错:_SQL复制:基本设置和配置

sql加载配置文件时出错:

This is article is a continuation of the previous: SQL Server replication: Overview of components and topography.

本文是上一篇文章的续篇: SQL Server复制:组件和拓扑概述

By now, you’re familiar with the components of replication. So far, we’ve seen a lot of theory about replication. It’s a time for practical walkthrough of setting up a basic transactional SQL Replication system. The best way to get a feel for how SQL Replication is implemented and how it works is to see it in action.

到目前为止,您已经熟悉复制的组件。 到目前为止,我们已经看到了很多有关复制的理论。 现在是设置基本事务型SQL复制系统的实际演练的时间。 感受一下SQL复制是如何实现的以及如何工作的最好方法是查看它的运行情况。

In this article, we’ll perform some simple exercises to setup a transactional SQL Replication solution. Transactional SQL Replication is a common solution to most of the problems of moving data continuously between different SQL Server databases. The good news is we have some robust tools available and it is very simple to use the Replication Wizard with which you can easily configure and administer your SQL Replication topology.

在本文中,我们将执行一些简单的练习来设置事务性SQL复制解决方案。 事务性SQL复制是解决在不同SQL Server数据库之间连续移动数据的大多数问题的通用解决方案。 好消息是我们提供了一些强大的工具,使用复制向导非常简单,您可以使用该向导轻松配置和管理SQL复制拓扑。

This guide will cover

本指南将涵盖

  1. Initial SQL replication setup

    初始SQL复制设置
  2. Pre-requisites

    先决条件
  3. How to prepare the replication snapshot folder

    如何准备复制快照文件夹
  4. How to configure a SQL replication distributor

    如何配置SQL复制分发服务器
  5. How to create a SQL replication publisher

    如何创建SQL复制发布者
  6. How to create a SQL replication subscriber

    如何创建SQL复制订阅服务器
  7. And more…

    和更多…

先决条件 (Pre-requisites)

  1. The account must at minimum be a member of the db_owner fixed database role in the SQL replication Publisher, Distributor and Subscriber databases

    该帐户至少必须是SQL复制Publisher,Distributor和Subscriber数据库中db_owner固定数据库角色的成员。
  2. For securing the replication snapshot folder using a Snapshot Agent, the account must have read and write or modify permission on the replication snapshot share

    为了使用快照代理保护复制快照文件夹的安全,该帐户必须具有对复制快照共享的读写权限或修改权限。
  3. At least one database should have an article and must possess Primary Key; a basic rule that every article should have a Primary Key is considered as best candidate for Transactional SQL Replication. The primary key is used to maintain uniqueness of records.

    至少一个数据库应该有一篇文章,并且必须拥有主键; 每个文章都应具有主键的基本规则被认为是事务性SQL复制的最佳人选。 主键用于维护记录的唯一性。
  4. Scheduling the agent and jobs

    安排代理人和工作
  5. Sufficient network bandwidth

    足够的网络带宽
  6. Enough disk space for the databases being published; we need to make sure that we have enough space available for the SQL transaction log for the published database

    用于发布数据库的足够磁盘空间; 我们需要确保我们有足够的空间用于发布数据库SQL事务日志

最初设定 (Initial setup)

The exercises demonstrate how to configure SQL Replication to copy a few tables, stored procedures and views from AdventureWorks2016 sample database to another database. To keep this setup simple, we use SQL Server Management Studio. The transactional replication setup has a single SQL Server instance to play the roles of SQL replication Publisher, Distributor, and another SQL Server instance play the role of the SQL replication Subscriber.

练习演示了如何配置SQL复制以将几个表,存储过程和视图从AdventureWorks2016示例数据库复制到另一个数据库。 为了简化此设置,我们使用SQL Server Management Studio。 事务复制设置具有一个SQL Server实例,以充当SQL复制Publisher,Distributor的角色,另一个SQL Server实例,扮演SQL复制Subscriber的角色。

入门 (Getting Started)

To first set up transaction SQL replication, you must configure the SQL replication Distributor and create a SQL replication Publication, replication snapshot folder and a SQL replication Subscription.

要首先设置事务SQL复制,您必须配置SQL复制分发服务器并创建SQL复制发布,复制快照文件夹和SQL复制订阅。

配置发行人 (Configure Distributor)

The following steps walk you through the process of creating the SQL replication Distributor:

以下步骤将引导您完成创建SQL复制分发服务器的过程:

  1. Open SSMS and connect to the SQL Server instance

    打开SSMS并连接到SQL Server实例

  2. In Object Explorer, browse to the replication folder, right-click the Replication folder, and click Configure Distribution

    在“ 对象资源管理器”中 ,浏览到复制文件夹,右键单击“ 复制”文件夹,然后单击“ 配置分发”。

  3. The first page of the Distribution Configuration Wizard appears. The pages outline the general details about configuration distributor aka Configure Distribution Wizard

    出现“ 分发配置向导 ”的第一页。 这些页面概述了有关配置分发器(即“配置分发向导”)的一般详细信息

  4. On the Distributor page, you’ve an option to choose to set up the current instance to be a Distributor or select another instance that’s already been configured as a Distributor. In this case, the distributor is local so leave the default setting “‘ServerName’ will act as its own Distributor;SQL Server will create a distribution database and log” and Click Next.

    在“ 分发服务器”页面上,您可以选择将当前实例设置为分发服务器,也可以选择已配置为分发服务器的另一个实例。 在这种情况下,分发服务器是本地的,因此保留默认设置“'服务器名称'将充当其自己的分发服务器; SQL Server将创建分发数据库并记录日志”,然后单击“ 下一步”

  5. Next, in the configure Snapshot Folder, type in the path of the SQL replication snapshot folder or leave the default path of the SQL replication snapshot folder. The snapshot folder is used for initial data synchronization of transactional replication and make sure it is large enough to hold all the replicated data. In this case, I’ll leave the default values and Click Next.

    接下来,在configure Snapshot Folder中 ,输入SQL复制快照文件夹的路径或保留SQL复制快照文件夹的默认路径。 快照文件夹用于事务复制的初始数据同步,并确保它足够大以容纳所有复制的数据。 在这种情况下,我将保留默认值,然后单击Next

  6. Now, configure the SQL replication distribution database. Specify the name of the distribution database and the folders where the data and log files should be located. Again, no change in the default values is required. Click Next.

    现在,配置SQL复制分发数据库。 指定分发数据库的名称以及数据和日志文件应位于的文件夹。 同样,无需更改默认值。 单击下一步

  7. In the Publishers page, specify the SQL replication Publishers that are going to access the Distributor and Click Next

    在“ 发布者”页面中,指定将要访问分发服务器SQL复制发布者,然后单击“下一步”。

  8. In Wizard Actions, You’ve an option to run immediately or create a script that can be executed at a later time and Click Next

    在“ 向导操作”中 ,您可以选择立即运行或创建可以在以后执行的脚本,然后单击“ 下一步”。

  9. In the complete the wizard page, Review the settings and configuration options, and then click Finish to enable the Distributor

    完整的向导页面中,查看设置和配置选项,然后单击“ 完成”以启用分发服务器

  10. Now, for Configuring… the following page appears and it shows the progress of the distributor setup.

    现在,对于配置… ,将显示以下页面,其中显示了分发服务器设置的进度。

配置发布者 (Configure Publisher)

Once you’ve configured the Distributor, you can create a publication. Let’s follow the steps:

一旦配置了分发服务器,就可以创建发布。 让我们按照以下步骤操作:

  1. In Object Explorer, locate the Replication folder, right-click Local Publication, and then click New Publication

    对象资源管理器中 ,找到“ 复制”文件夹 ,右键单击“ 本地 发布” ,然后单击“ 新建发布”。

  2. Next, the New Publication Wizard appears and outlines the general information about creating Publication.

    接下来,出现“ 新发布向导 ”并概述有关创建发布的一般信息。

  3. In the Publication Database page, select the Adventureworks2016 database and click Next.

    在“ 发布数据库”页面中,选择Adventureworks2016数据库,然后单击“ 下一步”

  4. On the Publication Type page, select Transactional publication, and click Next.

    在“ 发布类型”页面上,选择“ 事务性发布” ,然后单击“ 下一步”

  5. Now, on the Articles page, choose the articles should be part of this publication

    现在,在“ 文章”页面上,选择文章应成为此出版物的一部分

  6. Once you’re done with the object selection, Check the Show only checked articles in the list option to list candidates of Publication. In this case, 2 tables, 1 Stored Procedures are selected.

    完成对象选择后,选中“ 仅在列表中显示选中的文章”选项 列出出版物的候选人。 在这种情况下,选择了2个表,1个存储过程。

  7. Next, in the Filter Table Rows page, define filters that should be applied to your articles. Let us go with the default values.

    接下来,在“ 筛选器表行”页面中,定义应应用于文章的筛选器。 让我们使用默认值。

  8. In the Snapshot Agent page specify when to run the Snapshot Agent. It can be run immediately or it can schedule to run at a later time. In this case, Create a snapshot immediately is used.

    在“ 快照代理”页面中,指定何时运行快照代理。 它可以立即运行,也可以计划在以后的时间运行。 在这种情况下,将使用立即创建快照

  9. Now, in the Agent Security page, specify the account to use to run the Snapshot Agent using Security settings…

    现在,在“ 代理安全性”页面上,使用“ 安全性”设置指定用于运行快照代理的帐户

  10. Click Ok

    点击确定

  11. In the complete Wizard Actions page, you’ve two options. You can create the Publication immediately or save the configuration in the script file to run at a later time.

    在完整的“ 向导操作”页面中,您有两个选择。 您可以立即创建发布,也可以将配置保存在脚本文件中以在以后运行。

  12. Type in the publication name and Click Finish.

    输入出版物名称,然后单击完成

  13. In the Creating Publication page, you’ll find information about the wizard’s progress as it works through each step of the process.

    在“ 创建发布”页面中,您将找到有关向导在过程的每个步骤中工作的进度的信息。

  14. Now, you can see that Publication is created under the local publication folder

    现在,您可以看到在本地发布文件夹下创建了发布。

    配置订户 (Configure Subscriber)

    The final step in setting up replication is to create the subscription. Let us walk-through the steps:

    设置复制的最后一步是创建预订。 让我们逐步执行以下步骤:

    1. In Object Explorer, expand the Replication folder, right-click Local Subscriptions, and then click New Subscriptions

      在对象资源管理器中,展开“复制”文件夹,右键单击“本地订阅”,然后单击“新建订阅”

    2. The New Subscription Wizard appears outlines the general information about the wizard.

      出现“新订阅向导”,概述有关该向导的一般信息。

    3. On the Publication page, select Publication and then click Next

      在“ 发布”页面上,选择“发布”,然后单击“ 下一步”。

    4. On the Distribution Agent location page, select “Run all agents at the Distributor” and Click Next

      在“分发代理位置”页面上,选择“ 在分发服务器上运行所有代理”,然后单击“ 下一步”。

    5. On the Subscribers page, select Add Subscriber, and then select Add SQL Server Subscriber from the drop-down. This step opens the Connect to Server dialog box. Enter the subscriber instance name and then select Connect.

      在“ 订户”页面上,选择“ 添加订户” ,然后从下拉列表中选择“添加SQL Server订户”。 此步骤将打开“连接到服务器”对话框。 输入订户实例名称,然后选择“连接”。

    6. After the subscriber SQL instance has been added, select the drop-down next to the instance name of your subscriber. Then select New Database under Subscription Database and type in the database name and Click Ok.

      添加订户SQL实例后,选择订户的实例名称旁边的下拉列表。 然后在“订阅数据库”下选择“新建数据库”,然后输入数据库名称,然后单击“确定”。

    7. The subscription database is created and registered to the subscriber. Now, click Next. Make sure that the account has db_owner permission on the newly created database.

      订阅数据库已创建并注册到订阅者。 现在,单击“下一步”。 确保该帐户对新创建的数据库具有db_owner权限。

    8. On the Distribution Agent Security page, select the ellipsis (…) button. Type in the process account details and Click Ok.

      在“ 分发代理程序安全性”页上,选择省略号(...)按钮。 输入流程帐户详细信息,然后单击“确定”。

    9. Select Finish accepting the default values on the remaining pages and completing the wizard.

      选择完成以接受其余页面上的默认值并完成向导。

    10. On the complete the wizard page, you can see the detailed summary of the newly created subscription. Click Finish

      在完成的向导页面上,您可以看到新创建的订阅的详细摘要。 点击完成

    11. In the Creating Subscription(s)…page should show that the process has been successful or not.

      在“ 创建订阅…”页面中,应显示该过程是否成功。

    12. Connect to the publisher in SQL Server Management Studio. In the Object explore, right-click the Replication folder, and then select Launch Replication Monitor to verify the status of the newly created transactional replication setup.

      连接到SQL Server Management Studio中的发布者。 在“对象”浏览器中,右键单击“复制”文件夹,然后选择“启动复制监视器”以验证新创建的事务复制设置的状态。

    SQL复制总结 (SQL replication wrap Up)

    In this article, we’ve successfully configured Publisher, Local Distributor and a remote Subscriber transactional SQL replication model. You can now insert, delete, or update the data in the Address and AddressType articles to see the data propagation mechanism between the servers.

    在本文中,我们已经成功配置了发布服务器,本地分发服务器和远程订阅服务器事务SQL复制模型。 现在,您可以在Address和AddressType文章中插入,删除或更新数据,以查看服务器之间的数据传播机制。

    In the next article, we will see how to run rebuild the setup using a backup file. Stay tuned…

    在下一篇文章中,我们将看到如何使用备份文件来运行重建设置。 敬请关注…

    目录 (Table of contents)

    SQL Server replication: Overview of components and topography
    SQL Replication: Basic setup and configuration
    How to Add/Drop articles from existing publications in SQL Server
    How to do a quick estimated compare of data in two large SQL Server databases to see if they are equal
    SQL Server transactional replication: How to reinitialize a subscription using a SQL Server database backup
    How to setup a custom SQL Server transaction replication model with a Central Subscriber and Multiple Publisher databases
    How to setup custom SQL Server transactional replication with a central publisher and multiple subscriber databases
    How to set up a DDL and DML SQL Server database transactional replication solution
    How to setup cross-platform transactional SQL Server replication for database reporting on Linux
    SQL Server database migrations with zero data loss and zero downtime
    Using transactional data replication to replay and test production loads on a staging server
    How to setup SQL Server database replication for a reporting server
    SQL Server transactional replication: How to reinitialize a subscription using a “Replication support only” –TBA
    SQL Server Replication Monitoring and setting alerts using PowerShell –TBA
    SQL Server复制:组件和拓扑概述
    SQL复制:基本设置和配置
    如何从SQL Server中的现有出版物中添加/删除文章
    如何对两个大型SQL Server数据库中的数据进行快速估计比较,以查看它们是否相等
    SQL Server事务复制:如何使用SQL Server数据库备份重新初始化订阅
    如何使用中央订阅服务器和多个发布者数据库设置自定义SQL Server事务复制模型
    如何使用中央发布者和多个订阅者数据库设置自定义SQL Server事务复制
    如何设置DDL和DML SQL Server数据库事务复制解决方案
    如何在Linux上为数据库报告设置跨平台事务SQL Server复制
    SQL Server数据库迁移,数据丢失为零,停机时间为零
    使用事务数据复制来重放和测试登台服务器上的生产负载
    如何为报表服务器设置SQL Server数据库复制
    SQL Server事务复制:如何使用“仅复制支持” –TBA重新初始化订阅
    使用PowerShell –TBASQL Server复制监视和设置警报

翻译自: https://www.sqlshack.com/sql-replication-basic-setup-and-configuration/

sql加载配置文件时出错:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值