sql server 快照

In the last articles, we have learned Configuring Snapshot and Transactional SQL Server replication and Configuring Peer to Peer and Merge SQL replication. Now, once we configured SQL Server replication, there will be some instances where we need to modify the SQL Server replication configuration as per the project updates. In this article, we will learn a few modifications in the existing SQL Replication such as Add new article, drop an article and change the Snapshot folder path and data filter in the current SQL Server replication.

在上一篇文章中,我们学习了配置快照和事务型SQL Server复制以及配置点对点和合并SQL复制 。 现在,一旦我们配置了SQL Server复制,就会有一些实例需要根据项目更新来修改SQL Server复制配置。 在本文中,我们将学习对现有SQL复制的一些修改,例如添加新文章,删除文章并更改当前SQL Server复制中的Snapshot文件夹路径和数据过滤器。

将新文章添加到现有已发布的数据库中 (Add new Articles into the existing published database)

In this section, we will learn, Add a new article into the existing published database. Once we created the publication, the publication contains few sets of database objects like tables, views and stored procedures. As per the project requirement sometimes we need to create new tables or views or stored procedures into the existing published database for some calculations or storing specific limited data. If we also wish to replicate those tables or views or stored procedures into the current SQL replication, then we need to add new database objects into the published database. This section will help to insert new articles into the existing published database of the SQL Server replication.

在本节中,我们将学习将新文章添加到现有已发布的数据库中。 创建发布后,发布包含几组数据库对象,例如表,视图和存储过程。 根据项目要求,有时我们需要在现有的已发布数据库中创建新表或视图或存储过程,以进行一些计算或存储特定的有限数据。 如果我们还希望将这些表或视图或存储过程复制到当前SQL复制中,则需要将新的数据库对象添加到已发布的数据库中。 本节将帮助将新文章插入到SQL Server复制的现有已发布数据库中。

I have already configured the transactional SQL replication on the node SQL1 for the database AdventuresWorksLT2012 as shown in the following fig.

我已经在数据库AdventuresWorksLT2012的节点SQL1上配置了事务SQL复制,如下图所示。

Before adding a new article, first, we need to check, which are the database objects are already part of the SQL Server replication. Right-click the configured publication of the database and Go to Publication properties where we will get a list of articles which are part of the SQL replication.

在添加新文章之前,首先,我们需要检查哪些数据库对象已经是SQL Server复制的一部分。 右键单击已配置的数据库发布,然后转到发布属性 ,我们将在其中获得属于SQL复制的文章列表。

In the following fig. articles which ticked are already part of SQL Server replication.

在下图。 勾选的文章已经是SQL Server复制的一部分。

The new articles which need to add into publication database, First, un-check Show only checked items in the list option as shown in the following fig. we will get a list of all the objects from the database. We will select new tables ProductCategory and ProductDescription from the following list and click OK.

需要添加到发布数据库中的新文章,首先,取消选中lis t选项中的“仅显示选中的项目”,如下图所示。 我们将从数据库中获取所有对象的列表。 我们将从下面的列表中选择新表ProductCategoryProductDescription ,然后单击OK。

Once we added the new list of articles in the current publication, right-click Configured publication and select Reinitialize all Subscription as the following.

一旦我们在当前出版物中添加了新的文章列表,请右键单击“配置的出版物”,然后选择“ 重新初始化所有订阅 ”,如下所示。

Click on the Use a new snapshot; this option will able to create a new snapshot till time and click on Mark for Reinitialization.

单击“ 使用新快照” ; 该选项将能够创建一个新的快照,直到出现时间,然后单击“ 标记为重新初始化”

Right-click configured publication and Select Launch Replication Monitor.

右键单击配置的发布,然后选择启动复制监视器

Go to Agent tab as shown in the following.

转到代理选项卡 ,如下所示。

Right-click on snapshot section and click start agent, this process will create a new snapshot after adding the new articles in the current publication and will be used for the further SQL replication process.

右键单击快照部分,然后单击启动代理 ,此过程将在当前出版物中添加新文章后创建一个新快照,并将用于进一步SQL复制过程。

After running agent, we can check Last start time and last action and duration of snapshot run as shown in the following window.

运行代理后,我们可以检查快照的 上次启动时间上次操作快照的持续时间,如下窗口所示。

After creating a new snapshot, we will verify the status of the snapshot agent. Right-click the publication and select View Snapshot Agent Status as the following.

创建新快照后,我们将验证快照代理的状态。 右键单击发布,然后选择“ 查看快照代理状态 ”,如下所示。

Snapshot agent status is in a healthy state. A snapshot of 9 articles generated as shown on the following fig.

快照代理状态为健康状态。 生成的9个文章的快照,如下图所示。

After adding new articles in the current publication, we can verify that new articles have added to the subscriber server SQL2 as shown in the following fig.

在当前出版物中添加新文章之后,我们可以验证新文章已添加到​​订户服务器SQL2中,如下图所示。

从出版物中删除表 (Drop Table from the publication)

In this section, we will learn about to drop a table from the publication.

在本节中,我们将学习从出版物中删除表格。

The table Customer of the database AdventureWorksLT_2012 is part of the SQL Server replication. We will try to drop it as the following; however, it will not allow us to drop it because a table configured as an article in the SQL replication and It will throw an error as shown in the following.

数据库AdventureWorksLT_2012的 客户表是SQL Server复制的一部分。 我们将尝试如下删除它; 但是,它不允许我们删除它,因为在SQL复制中配置为项目的表会引发错误,如下所示。

Before dropping a table, first, we need to remove a table from the publication. Right-click publication and Go to Publication Properties. So, we want to drop a table Customer, so Let’s uncheck it from the list of objects to publish section. Once we uncheck it, we will get a pop-up warning click Yes.

在删除表之前,首先,我们需要从发布中删除表。 右键单击发布,然后转到发布属性 。 因此,我们要删除一个表Customer ,因此让我们从要发布的对象列表中取消选中它。 取消选中它后,我们将弹出警告,单击

Once clicked on Yes, we will get a pop-up to create a new snapshot. Select Use a new snapshot and click Mark for Reinitialization.

单击“是”后,我们将弹出一个窗口以创建一个新快照。 选择“ 使用新快照”然后单击“ 标记为重新初始化”

Right-click publication and Go to Replication monitor. Right-click view details.

右键单击发布,然后转到“复制”监视器 。 右键单击查看详细信息

The following section gives us the history of the snapshot agent. The next part shows nine articles have generated after removing one article from the publication.

下一节为我们提供了快照代理的历史记录。 下一部分显示从出版物中删除一篇文章后生成的九篇文章。

Right-click publication and click Reinitialize

用鼠标右键单击发布,然后单击重新初始化

Click Use the current snapshot to reflect the results on the subscriber.

单击“ 使用当前快照以将结果反映到订阅服务器上”。

Drop the table on the publisher SQL1 as the following

将表放在发布服务器SQL1上,如下所示

On the subscriber SQL2, we can verify the table removed from the subscriber.

在订户SQL2上,我们可以验证从订户中删除的表。

更改快照文件夹路径 (Change Snapshot folder Path)

While configuring SQL Server Distribution database, we had given the following snapshot folder path. In this section, we will learn to change the snapshot folder path in the from the current distribution.

在配置SQL Server Distribution数据库时,我们给出了以下快照文件夹路径。 在本节中,我们将学习从当前发行版更改的快照文件夹路径。

Right-click publication and Go to properties.

右键单击发布,然后转到属性

Go to Snapshot page on the left side and check current snapshot files path.

转到左侧的“ 快照”页面 ,并检查当前快照文件的路径。

To change the path, Right-click Replication folder and click Distribution Properties.

要更改路径,请右键单击“复制”文件夹 ,然后单击“ 分发属性”

In the Publisher page section, click on the icon in the following fig.

在“发布者”页面部分中,单击下图中的图标。

Provide the new correct path and click OK

提供新的正确路径,然后单击“ 确定”。

资料筛选器 (Data Filter)

SQL Server replication provides an excellent feature to filter the data using the Column data filter. In the data filter, we will able to show the column which we want to display for the reposting purpose. We can remove the column which contains sensitive information like customer name, customer email, credit card, etc.

SQL Server复制提供了一项出色的功能,可以使用列数据筛选器筛选数据。 在数据过滤器中,我们将能够显示要重新发布的列。 我们可以删除包含敏感信息的列,例如客户名称,客户电子邮件,信用卡等。

In the project environment, we build a dashboard in the tableau framework. Client vendors used to access those tableau dashboards for data analysis purposes. In that, we want to show data information of the one particular vendor to that specific vendor only. We do not want to show one vendor information to another vendor. So to limit data visibility, we will set-up SQL Server replication with data filter option.

在项目环境中,我们在tableau框架中构建一个仪表板。 客户端供应商过去曾访问这些Tableau仪表板以进行数据分析。 这样,我们只想向该特定卖方显示一个特定卖方的数据信息。 我们不想将一个供应商信息显示给另一供应商。 因此,为了限制数据可见性,我们将使用数据过滤器选项设置SQL Server复制。

Once the distribution database configured, we will proceed to set the publication.

配置分发数据库后,我们将继续设置发布。

Right-click Replication folder and select New Publication. Select the database AdventureWorksLT2012 as the following and click Next

右键单击复制文件夹,然后选择新建发布 。 选择数据库AdventureWorksLT2012 ,如下所示,然后单击“下一步”。

Select the required database objects and click Next

选择所需的数据库对象,然后单击“ 下一步”。

In the Filter Table Rows window, if we do not want to filter data, we can skip this step. Now we need to filter data so that we will configure this section window. Click on Add as shown in the following.

在“ 过滤表行”窗口中,如果不想过滤数据,则可以跳过此步骤。 现在我们需要过滤数据,以便我们配置此部分窗口。 单击添加 ,如下所示。

Select the table we need to use for the data filter. We selected the table Customer from the SalesLT schema. Next, we need to add the column which contains sensitive information on the right-side filter statement. We will apply the condition for the specified column, and it will show the results only for the conditional statement.

选择我们需要用于数据过滤器的表。 我们从SalesLT模式中选择了表Customer 。 接下来,我们需要在右侧的filter语句上添加包含敏感信息的列。 我们将条件应用于指定的列,并且它将仅显示条件语句的结果。

In this case, we added the column CompanyName for the condition; company name starts with A

在这种情况下,我们为条件添加了CompanyName列; 公司名称以A开头

Once we added the table Customer in the filter section as shown in the following fig.

一旦我们在过滤器部分中添加了表Customer ,如下图所示。

In the Snapshot section, select a checkbox for Create a snapshot and click Next.

在“ 快照”部分中 ,选中“ 创建快照”复选框,然后单击“ 下一步”

In the Agent Security, configure the service account for the snapshot agent and the log reader agent as the following and click Next.

在“ 代理安全性”中 ,如下配置快照代理和日志读取器代理的服务帐户,然后单击“下一步”。

In the complete wizard window, provide publication name as the following and click Finish.

完整的向导窗口中 ,提供以下发布名称,然后单击“ 完成”

Publication is configured successfully as the following.

发布成功配置如下。

订户上的数据验证 (Data Verification on the Subscriber)

In this step, we will verify the data; On the Publisher server SQL1, we will retrieve records from the table Customer. We can see, the column CompanyName shows the values for all the company name.

在这一步中,我们将验证数据; 在发布服务器SQL1上,我们将从表Customer中检索记录。 我们可以看到, CompanyName列显示了所有公司名称的值。

In this step, we will verify the data on the Subscriber server SQL2. When we retrieved records for the same table on the subscriber server SQL2, we will get filter data for the condition which we have specified in the filter section. We got the company name which starts with only character A as shown in the following fig.

在此步骤中,我们将验证订阅服务器SQL2上的数据。 当我们在订阅服务器SQL2上检索同一表的记录时,我们将获得在filter部分中指定的条件的过滤器数据。 我们得到的公司名称仅以字符A开头,如下图所示。

目录 (Table of contents)

SQL Server replication configuration: Peer to Peer and Merge Replication
SQL Server replication: Configuring Snapshot and Transactional Replication
Add new articles, drop the article, change the snapshot folder path and Data filter rows in SQL Server Replication
SQL Server复制配置:点对点和合并复制
SQL Server复制:配置快照和事务复制
添加新文章,删除文章,更改快照文件夹路径和SQL Server复制中的数据筛选器行

翻译自: https://www.sqlshack.com/add-new-articles-drop-the-article-change-the-snapshot-folder-path-and-data-filter-rows-in-sql-server-replication/

sql server 快照

sql server 快照_添加新文章,删除文章,更改快照文件夹路径和SQL Server复制中的数据筛选器行相关推荐

  1. (解决 fatal error C1083: 无法打开包括文件:“xxxxxxxxx.h”: No such file or directory)VS和Eclipse添加新文件/文件夹路径步骤

    Visual Studio和Eclipse添加新文件/文件夹路径步骤 向VS工程中添加文件夹 把新增的头文件添加到路径中 Eclipse添加头文件 向VS工程中添加文件夹 首先添加相关的文件夹和文件– ...

  2. 苹果删除照片不释放内存_新买的手机变得很卡?试试删除这3个文件夹,释放大量内存...

    手机内存是很多人在买手机时都会看重的一点,因为手机内存大就能够下载更多的应用,游戏.对一些喜欢玩游戏的人来说,肯定会追求内存大的手机,因为这样对系统的流畅度还有安装的游戏都有更多的空间. 一些新买的手 ...

  3. 文件夹的位置_感觉电脑变卡了?删除这5个文件夹 C盘立马清爽

    感觉电脑最近变得有些卡顿? 很有可能是C盘的东西太多了.今天教大家一个办法,删除这5个文件夹,立马可以给C盘瘦身,释放大量空间. 一.Backup 这个文件夹是一个备份文件夹,有时候Windows会把 ...

  4. c++取临时文件夹_电脑C盘不足?学会删除这5个文件夹,能节省10G空间

    很多人在用电脑的时候,都喜欢把各种文件都放到C盘中,时间长了后就会导致C盘空间严重不足,今天小编来教您删除这5个文件夹,能帮你省下大量的空间. 一.Backup 这是一个专门备份的文件夹,一些装机软件 ...

  5. 苹果删除照片不释放内存_别再胡乱清理垃圾了,只要删除这6个文件夹,瞬间释放20GB内存...

    大家好,我是你们的好朋友护肤小晨铺,一个喜欢在健康生活美容护肤领域不断探索的小编,为的是可以和大家一起在健康生活的路上一起走的更远,虽然我们素未谋生,但是我相信文字的感染力,让我们此刻相聚在一起,人家 ...

  6. bilibili缓存文件在哪里_别再盲目清理了,手机删除这3个文件夹,能瞬间清出十几G垃圾...

    我们在使用手机的过程中都会定期清理一下手机缓存垃圾,第一可以让手机内存变大,手机能储存更多的东西:第二可以让手机变得流畅一点,毕竟内存不足手机也会变得特别卡顿.不少朋友都是使用手机自带的清理软件清除的 ...

  7. 苹果删除照片不释放内存_安卓手机卡怎么办?只要删除这6个文件夹,瞬间释放10GB内存...

    安卓手机卡怎么办?只要删除这6个文件夹,瞬间释放10GB内存!现在的手机APP在不断的使用过程中会产生很多的缓存软件,很占我们的手机内存,虽说现在有手机中都有自带清理的功能,不过效果依旧不是很明显.特 ...

  8. 删除所有的.svn文件夹

    删除所有的.svn文件夹 工作中要把一个项目迁移到另外的svn目录中,遇到一个问题,需要先把原来的.svn删除,然后再增加到新的svn中,开始手动删除,但是发现太耗时耗力了,网上搜了几种删除的方法,自 ...

  9. linux批量删除指定名称的文件夹

    linux批量删除指定名称的文件夹 find /root/baseline_dataset -name .ipynb_checkpoints | xargs rm -rf find # find 命令 ...

最新文章

  1. Linux - 收藏集 - 掘金
  2. python爬虫抓收费图片_简单的Python抓taobao图片爬虫
  3. 弱电工程网络传输基础知识讲解
  4. docker二进制安装mysql_Docker搭建MySQL读写分离主从模式 分布式数据库中间件Mycat分库分表应用...
  5. docker 删除所有镜像_Docker常用命令
  6. PyTorch实战福利从入门到精通之一——PyTorch框架安装
  7. 自学Python6个月,你能找到工作吗?
  8. 了解分布式系统和分布式系统中需要掌握的痛点
  9. win10 没有计算机策略,Win10家庭版没有组策略怎么办
  10. 4月13日云栖精选夜读:雪佛兰和阿里妈妈撒红包雨!到店率增加20%是如何做到的?...
  11. 【华为云】python调用华为云API,获取token值
  12. LOL-无双剑姬我的最爱
  13. echarts渐变色
  14. android存储视频文件夹在哪,Android 中 视频存储路径的一个方案
  15. php数独,php数独求解
  16. 世界上最好的图片无损压缩软件
  17. 让Firefox像vim一样操作
  18. 乡村少年宫计算机班活动记录,乡村少年宫科技兴趣小组活动记录
  19. meteor构建app程序_在Meteor.js中构建Slack克隆:实时数据
  20. Chrome 出现“您未安装Flash Player播放器或者版本过低”问题

热门文章

  1. SpringBoot + Mybatis/JPA
  2. java的多线程学习,第四记
  3. Java 基于javaMail的邮件发送(支持附件)
  4. ubuntu HackRF One相关环境搭建
  5. 64位BASM学习随笔(一)
  6. 总结JavaScript中的继承
  7. 这周的工作任务,编写sql存储过程
  8. 【电商系统】—项目梳理(一)
  9. FreeNAS 是什么
  10. 回购价低于股价怎么办?