Home Database Mysql Tutorial SQL Server从备份初始化的事务复制中添加发布项目

SQL Server从备份初始化的事务复制中添加发布项目

Jun 07, 2016 pm 05:54 PM
sql server

有时候,您可能首先从备份初始化了一个事务订阅,然后你又需要添加一个项目(Article)。如果订阅方是由快照初始化的,你可以重新运行快照代理产生新的快照,其中只有新添加的那个项目被BCP出然后在订阅方BCP入。但是,如果是使用备份/还原建立的订阅,其快

有时候,您可能首先从备份初始化了一个事务订阅,然后你又需要添加一个项目(Article)。如果订阅方是由快照初始化的,你可以重新运行快照代理产生新的快照,其中只有新添加的那个项目被BCP出然后在订阅方BCP入。但是,如果是使用备份/还原建立的订阅,其快照代理是不起作用的。

因而,在这种情况下,当一个新建表需要被新添加进发布时有两种方式:

1.只为那一个项目创建新发布。使用发布向导或脚本,并选择默认选项向订阅推送一个新的快照。同一个发布上的多个发布共享一个日志读取代理,而各个分发代理将会并行地将数据复制到订阅方。

或者,

2.使用下面的步骤,向已有的发布中添加新项目,并在重启复制之前手动同步数据。

下面是方式2的具体实施步骤:

1)       停止日志读取代理(log reader agent)。

2)       在发布方停止对新建项目进行数据更改(注意,当数据正从此发布表中拷贝出时,直到此表已经通过sp_addarticle被添加到了发布中,这段期间我们必须确保停止对此数据表的所有更改。)

3)       生成一个表结构脚本,在订阅方创建表,并将此表中的数据从发布方拷贝到订阅方。

A.      对于新建的或小型数据表,可以使用INSERT INTO… SELECT * FROM语句直接传输数据

B.      对于已有很多数据的表,创建一个SSIS包,从而在远程服务器上创建并加载表。

4)       使用sp_addarticle存储过程将项目添加到发布中。(关于sp_addarticle的说明,请参见:)

当然,你也可以通过复制相关的向导来添加新的项目到发布中。比如:

- 右键点击复制打开发布的属性窗口

SQL Server从备份初始化的事务复制中添加发布项目

- 在发布属性窗口中点击目标表加入发布中

SQL Server从备份初始化的事务复制中添加发布项目

- 点击确认保存

5)       开启日志读取代理

6)       现在你可以开始在此表上做数据更改,因为日志读取器将会从此开始跟踪表的数据变化并复制到订阅端。

请注意,

- 当备份已经包括了该表,如果它仍存在于订阅方,而且那个表没有架构变化的情况下,就不需在订阅方重新创建它,只需要保证人工同步数据即可。

- 在开启日志读取器代理之前,比较发布方和订阅方上新添加表的行数,确定发布方和订阅方所含的数据量是一样的。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What software is microsoft sql server? What software is microsoft sql server? Feb 28, 2023 pm 03:00 PM

Microsoft SQL Server is a relational database management system launched by Microsoft. It is a comprehensive database platform that uses integrated business intelligence (BI) tools to provide enterprise-level data management. It is easy to use, has good scalability, and has a high degree of integration with related software. High advantages. The SQL Server database engine provides more secure and reliable storage functions for relational data and structured data, allowing users to build and manage highly available and high-performance data applications for business.

SQL Server or MySQL? New research reveals the best database choices. SQL Server or MySQL? New research reveals the best database choices. Sep 08, 2023 pm 04:34 PM

SQLServer or MySQL? The latest research reveals the best database selection. In recent years, with the rapid development of the Internet and big data, database selection has become an important issue faced by enterprises and developers. Among many databases, SQL Server and MySQL, as the two most common and widely used relational databases, are highly controversial. So, between SQLServer and MySQL, which one should you choose? The latest research sheds light on this problem for us. First, let

PHP and SQL Server database development PHP and SQL Server database development Jun 20, 2023 pm 10:38 PM

With the popularity of the Internet, website and application development has become the main business of many companies and individuals. PHP and SQLServer database are two very important tools. PHP is a server-side scripting language that can be used to develop dynamic websites; SQL Server is a relational database management system developed by Microsoft and has a wide range of application scenarios. In this article, we will discuss the development of PHP and SQL Server, as well as their advantages, disadvantages and application methods. First, let's

How to connect to a Microsoft SQL Server database using PDO How to connect to a Microsoft SQL Server database using PDO Jul 29, 2023 pm 01:49 PM

Introduction to how to use PDO to connect to a Microsoft SQL Server database: PDO (PHPDataObjects) is a unified interface for accessing databases provided by PHP. It provides many advantages, such as implementing an abstraction layer of the database and making it easy to switch between different database types without modifying a large amount of code. This article will introduce how to use PDO to connect to a Microsoft SQL Server database and provide some related code examples. step

A brief analysis of five methods of connecting SQL Server with PHP A brief analysis of five methods of connecting SQL Server with PHP Mar 21, 2023 pm 04:32 PM

In web development, the combination of PHP and MySQL is very common. However, in some cases, we need to connect to other types of databases, such as SQL Server. In this article, we will cover five different ways to connect to SQL Server using PHP.

SQL Server and MySQL compete, how to choose the best database solution? SQL Server and MySQL compete, how to choose the best database solution? Sep 10, 2023 am 08:07 AM

With the continuous development of the Internet, database selection has become increasingly important. Among the many databases, SQLServer and MySQL are two high-profile options. SQLServer is a relational database management system developed by Microsoft, while MySQL is an open source relational database management system. So how to choose the best database solution between SQLServer and MySQL? First, we can compare these two databases in terms of performance. SQLServer is processing

SQL Server vs. MySQL: Which database is more suitable for high availability architecture? SQL Server vs. MySQL: Which database is more suitable for high availability architecture? Sep 10, 2023 pm 01:39 PM

SQL Server vs. MySQL: Which database is more suitable for high availability architecture? In today's data-driven world, high availability is one of the necessities for building reliable and stable systems. As the core component of data storage and management, the database's high availability is crucial to the business operation of the enterprise. Among the many databases, SQLServer and MySQL are common choices. So in terms of high availability architecture, which database is more suitable? This article will compare the two and give some suggestions.

SQL Server vs. MySQL comparison: Which one is better for large-scale data processing? SQL Server vs. MySQL comparison: Which one is better for large-scale data processing? Sep 09, 2023 am 09:36 AM

SQLServer and MySQL are currently two very popular relational database management systems (RDBMS). They are both powerful tools for storing and managing large-scale data. However, they have some differences in handling large-scale data. This article will compare SQL Server and MySQL, focusing on their suitability for large-scale data processing. First, let us understand the basic characteristics of SQLServer and MySQL. SQLServer is developed by Microsoft

See all articles