SQL 2005妙用跟踪令牌定位事务复制的延迟问题
我们知道,事务复制是将数据从发布服务器传到分发服务器然后复制到订阅服务器的过程 - 数据流几乎是实时地进行这些步骤。当有问题产生而造成流程中断,就会出现数据复制延迟。我们经常碰到的难题和关键是定位到哪一步是整个延迟的原因。从SQL2005开始支持的
我们知道,事务复制是将数据从发布传到分发然后复制到订阅服务器的过程 - 数据流几乎是实时地进行这些步骤。当有问题产生而造成流程中断,就会出现数据复制延迟。我们经常碰到的难题和关键是定位到哪一步是整个延迟的原因。从SQL2005开始支持的跟踪令牌功能,可以帮助我们轻松确定延迟问题是出现在1)从发布服务器到分发服务器,还是2)从分发服务器到订阅服务器。
跟踪令牌
跟踪令牌是一种特殊的时间戳事务,可以从复制监视器或运行T-SQL语句插入,它会被写到发布的事务日志中并被日志读取代理获取。之后被分发代理读取并写到订阅服务器。每一步的时间戳都被记录到分发的跟踪表中并显示在复制监视器或通过T-SQL语句获得。见下图:
在SQL Server Management Studio中,右击Replication(复制),然后选择Launch Replication Monitor(启动复制监视器)。
在复制监视器中,选择事务复制发布,然后打开Tracer Tokens页面。点击Insert Tracer插入新令牌。在插入跟踪令牌之后,复制监视器显示“Pending…”。
当日志读取代理获取令牌后,它会在分发数据库的Mstracer_token系统表中记录时间 – 通过计算插入令牌和日志读取代理获得令牌的时间差,来获得Publisher到Distributor的时间;然后分发代理获取令牌和并在分发数据库的Mstracer_history系统表中记录写入订阅方的时间 - 通过计算日志读取代理获得令牌和分发代理获取令牌并写入订阅方的时间差,来获得Distributor到Subscriber的时间。
跟踪令牌示例
在这个示例中,延迟大约持续了6秒,其中订阅方的写入只有1-2秒,但跟踪令牌却用了5秒将它们从发布服务器复制到分发服务器。因而,此示例中的事务延迟的关键显然应从日志读取代理开始而非分发代理。
再来看另一个例子,令牌复制到分发服务器用了3秒,但是到订阅服务器#1用了1秒,到订阅服务器#2用了4秒。尽管日志读取代理不像想象中那么快,但改进到订阅服务器#2的延迟将可以减少至少一半的整体延迟。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

What is Identity in SQL? Specific code examples are needed. In SQL, Identity is a special data type used to generate auto-incrementing numbers. It is often used to uniquely identify each row of data in a table. The Identity column is often used in conjunction with the primary key column to ensure that each record has a unique identifier. This article will detail how to use Identity and some practical code examples. The basic way to use Identity is to use Identit when creating a table.

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

Solution: 1. Check whether the logged-in user has sufficient permissions to access or operate the database, and ensure that the user has the correct permissions; 2. Check whether the account of the SQL Server service has permission to access the specified file or folder, and ensure that the account Have sufficient permissions to read and write the file or folder; 3. Check whether the specified database file has been opened or locked by other processes, try to close or release the file, and rerun the query; 4. Try as administrator Run Management Studio as etc.

1. First, we open the [Search] App on the mobile phone and select the device in the list on the device interface. 2. Then, you can check the location and click on the route to navigate there.

Database technology competition: What are the differences between Oracle and SQL? In the database field, Oracle and SQL Server are two highly respected relational database management systems. Although they both belong to the category of relational databases, there are many differences between them. In this article, we will delve into the differences between Oracle and SQL Server, as well as their features and advantages in practical applications. First of all, there are differences in syntax between Oracle and SQL Server.
