Tải bản đầy đủ (.pdf) (10 trang)

Tài liệu Apress - Pro SQL Server 2008 Replication (2009)02 docx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (506.01 KB, 10 trang )

CHAPTER 1

INTRODUCTION
15
SQL Server Configuration Manager
The SQL Server Configuration Manager is a management tool that acts as a one-stop interface
that allows administrators to configure and manage the services of SQL Server, SQL Server
Agent, SQL Server Analysis Services, and MS DTC. It can be integrated with other Microsoft
Management Console (MMC) applications. The SQL Server Configuration Manager is installed
with SQL Server 2008.

Note
The SAC tool does not exist in SQL Server 2008 anymore.
SQL Server Management Studio
The SQL Server Management Studio allows for the administration of services like Reporting
Services, Integration Services, Notification Services, and Replication. The Object Explorer is a
component of the SSMS, and it allows you to view lists of the objects for a particular instance
of SQL Server like a Database Engine, Analysis Service, Notification, and Integration Services.
It lists the System and user databases, the linked servers, Replication, and SQL Server Agent.
If you want to execute a query, the Object Explorer will also allow you to open the Query
Editor. The alternative way is to open a new Database Engine Query and connect to the server.

Tip
If you want to check the veracity of the T-SQL syntax in the Query Editor, you can highlight the state-
ment and press Shift+F1. It will take you directly to the online help. SQL Server 2008 has IntelliSense installed
in SQL Server Management Studio. You need to have IntelliSense enabled in order to use its features.
Database Engine Tuning Advisor
The Database Engine Tuning Advisor helps you to optimize the performance of the databases by
recommending the optimal set of indexes and types of physical design structures. This advisor is
also integrated with the SSMS.
Replication Monitor


The Replication Monitor lists the status of the publications and subscriptions. The interface for
the Replication Monitor has changed from what it was in SQL Server 2005. You can now launch the
Database Mirroring Monitor from the Replication Monitor. It is also possible to check replication
agent profiles, such as those for the Distribution, Snapshot, and Merge Agents, in the Replica-
tion Monitor. While a number of warnings are issued by default, it is possible to enable warnings
for other conditions. Alerts can be created and thresholds set to trigger those alerts.
The Replication Monitor can also monitor the performance of transactional and merge
replication by allowing you to set warnings and thresholds, view detailed synchronization
statistics of merge replication, and view transactions and delivery times for transactional
replication.
Paul_18074C01.fm Page 15 Tuesday, March 24, 2009 4:25 PM
16
CHAPTER 1

INTRODUCTION
Summary
This chapter introduced replication and the different tools available in SQL Server for configuring,
administering, monitoring, and troubleshooting replication.
• Databases that are logically interrelated and connected over the network are called
distributed databases.
• There are two methods of distributing data: distributed transactions and replication.
• Distributed transactions are coordinated by the MS DTC. A transaction manager coordi-
nates the distribution of the transaction with resource managers and the MS DTC log.
• The two-phase commit protocol is employed by the MS DTC to successfully execute
distributed transactions.
• Replication is the process by which copies of distributed data can be sent to remote sites.
• There are two kinds of replication: synchronous and asynchronous replication.
• SQL Server supports asynchronous replication.
• The benefits of using replication in a distributed data environment are scalability,
performance, and autonomy of the sites.

• SQL Server uses OLE DB to communicate with heterogeneous data sources like Oracle
by using the linked server.
• Replication has a higher autonomy and latency than distributed transactions.
• The Replication Monitor allows the monitoring of publications and subscriptions. It can
also be used to monitor the performance of snapshot, merge, and transactional replication.
In Chapter 2, I will introduce the Publisher-Subscriber model. We will look at articles,
publications, subscriptions, distribution, and agents, which will help you better understand
the fundamentals of replication. I will also show you how to set up replication in SQL Server.
Quick Tips
• Distributed processing involves sharing resources among the members of the network.
• The Microsoft OLE DB provider for SQL Server is installed automatically with SQL Server.
• The MS DTC log file is a binary file. It is needed for the transaction manager to start.
• In order to use IntelliSense in SSMS, you need to have IntelliSense enabled in SSMS.
Paul_18074C01.fm Page 16 Tuesday, March 24, 2009 4:25 PM
17
■ ■ ■
CHAPTER 2
Replication Basics
I
n the previous chapter, I introduced replication as a method of distributing data. I described
what asynchronous replication is and outlined the replication types available in SQL Server.
We are now ready to look at the details of replication. In this chapter, I will explain the Publisher-
Subscriber model that is used to represent the several components involved in replication: the
Distributor, Publisher, Subscriber, publications, articles, subscriptions, and agents. In addition,
you will also learn how different agents are used in transferring the data.
On completing this chapter, you will be able to do the following:
• Describe the Publisher-Subscriber model.
• Identify replication components.
• Apply agent types to different kinds of replication.
• Compare physical replication models.

Publisher-Subscriber Model
The Publisher-Subscriber model is based on a metaphor from the publishing industry. This
metaphor is a logical representation of the architecture the software industry has followed in
database replication.
Imagine you want to buy a couple of books on replication and SQL Server from a publisher
that publishes several books and magazines on database topics. The publisher packages the
books you order and sends them to the distributor. The distributor distributes these books and
magazines, which are then picked up by the different agents whose job is to sell them to you—
the subscriber. When you buy a book from a publisher, you are buying a publication. Each of
the chapters inside the book is an article of the publication. This is shown in Figure 2-1.
Paul_18074C02.fm Page 17 Tuesday, May 19, 2009 8:06 AM
18
CHAPTER 2

REPLICATION BASICS
Figure 2-1. The Publisher-Subscriber metaphor used in replication
Replication ensures the consistency and integrity of the databases at different server loca-
tions. Data is synchronized initially. For example, the Publisher server propagates the changes
or updates to the subscribing servers, albeit with a certain time lag. Any conflicts that arise are
resolved either programmatically or by the mechanisms provided by SQL Server. The corollary
to this is that changes made by the Subscriber servers can be sent back to the Publisher server
or republished to other subscribing servers.

Note
The paradigm of bidirectional replication has also been used with transactional replication, in which
data is replicated between tables on two servers. Each server has a copy of the table, and changes made in
one table get copied to the other server. Each server acts as both a Publisher and a Subscriber server to the
other server. Bidirectional transactional replication is discussed in Chapter 9.
Components of Replication
These are the different components of replication:

•Distributor
•Publisher
•Subscriber
•Publication
Paul_18074C02.fm Page 18 Tuesday, May 19, 2009 8:06 AM
CHAPTER 2

REPLICATION BASICS
19
•Article
•Subscriptions
• Agents
Distributor
The Distributor server is the common link that enables all the components involved in replica-
tion to interact with each other. It contains the distribution database, and it is responsible for
the smooth passage of data between the Publisher servers and the Subscriber servers.
If the Distributor server is located on the same machine as the Publisher server, it is known
as the local Distributor server, but if it is on a separate machine from the Publisher server, it is
called the remote Distributor server. In large-scale replication, it is better to house the Distributor
server on a remote server. This will not only improve performance, but also reduce I/O processing
and reduce the impact of replication on the Publisher server.

Note
Optimization for the three types of replication is discussed in Chapters 17 through 19.
The role of the Distributor server varies depending on the type of replication:
• In snapshot and transactional replication, the distribution database in the Distributor
server stores the replicated transactions temporarily and also stores the metadata and
the job history. The replication agents are also stored in the Distributor server, except in
cases where the agents are configured remotely or pull subscriptions are used. (A pull
subscription is one in which the Subscriber server asks for periodic updates of all changes

made at the publishing server.)
• In merge replication, unlike in snapshot and transactional replication, the distribution
database in the Distributor server stores the metadata and the history of the synchroni-
zation. It also contains the Snapshot Agent and the Merge Agent for push subscriptions.

Note
A push subscription is a subscription in which the Publisher server propagates the changes to the
subscribing servers without any specific request from the subscribing server.
The distribution database is a system database that is created when the Distributor server
is configured. You should not drop the distribution database unless you want to disable it. It
stores information about not only replication, but also the metadata, job history, and transactions.
Paul_18074C02.fm Page 19 Tuesday, May 19, 2009 8:06 AM

×