Wednesday, April 1, 2009

Setting Up Transactional Replication synchronization : A Step-by-step Guide

Setting Up Transactional Replication synchronization : A Step-by-step Guide
By Alexander Chigrik





General concepts
Checking necessary conditions
Checking connect
Example
Literature


General concepts
Replication is the process whereby data is copied between databases on the same server or different servers connected by LANs, WANs, or the Internet. Microsoft SQL Server replication uses a publish, distributor and subscribe metaphor.
Publisher is the server or database that sends its data to another server or database.

Subscriber is the server or database that receives data from another server or database.

Distributor is the server that manages the flow of data through the replication system. This server contains the distribution database.

Publisher contain publication/publications. Publication is a collection of one or more articles that is sent to a subscriber server or database. Article is the basic unit of replication and can be a table or a subset of a table.

Subscription is the group of data that a server or database will receive. This can be one or more publications. There are push and pull subscriptions. Push subscription is subscription when the publishing server will periodically push transactions out to the subscribing server or database. Pull subscription is subscription when the subscribing server will periodically connect to the distribution database and pull information.

Microsoft SQL Server support the following replication topologies:

Central publisher
Central subscriber
Central publisher with remote distributor
Publishing subscriber
Central publisher

This is one of the most common replication topologies. One server is configured as Publisher and Distributor and another server/servers is configured as Subscriber/Subscribers.







Central subscriber

This is a common topology in data warehousing. Many servers or databases replicate their data to a single central server or database.







Central publisher with remote distributor

In this topology distribution database resides on the another server than publisher. This topology uses for performance reasons when the level of replication activity increases or the server or network resources become constrained.
This topology requires separate Microsoft SQL Server installations, one for the Publisher and one for the Distributor.








Publishing subscriber

This is a dual role topology. In this topology, the publishing server or database also subscribes to another server or database. In this scenario two servers publish the same data. This is useful when a Publisher must send data to Subscribers over a slow or expensive communications link.









--------------------------------------------------------------------------------


Checking necessary conditions
Check the following before setting up transactional replication:

1. Remember that Microsoft SQL Desktop Edition supports only subscriptions to transaction replications. So you must use Microsoft SQL Standard, Enterprise or Small Business Server (SBS) editions to publish transaction replications. So for publish transaction replications you must have Windows NT Server, Windows NT Server Enterprise Edition or Windows NT Small Business Server (on Windows NT WorkStation and Windows 95/98 you may install only Microsoft SQL Desktop Edition version).
2. The Localsystem account has no access to shares on the network as it isn't an authenticated network account. So if you want to setting up replication you must change the account the MSSQLServer and SQLServerAgent services runs under to a account with the Windows NT administrator's rights.

3. Only members of the sysadmin server role can set up and configure replication, so if you have not this rights, you can not set up replication.

4. You must uncheck trunc. log on chkpt option, if you want to set up transactional replication.

5. Allocate adequate log space for each database that will be published in transactional replication.

6. Allocate adequate disk space for the distribution database.

7. Ensure the server that is being replicated to is defined as a remote server.



--------------------------------------------------------------------------------


Checking connect
1. Check TCP/IP with ping utility.
2. Check odbc connection with odbcping utility.

It's full syntax of odbcping utility: odbcping [-S Server | -D DSN] [-U Login Id] [-P Password]

If you receive this message, then you ms sql server start and work okay:

"
CONNECTED TO SQL SERVER

ODBC SQL Server Driver Version: 03.70.0623

SQL Server Version: Microsoft SQL Server 7.00 - 7.00.623 (Intel X86)
Nov 23 1998 21:08:09
Copyright (c) 1988-1998 Microsoft Corporation
Standard Edition on Windows NT 4.0 (Build 1381: Service Pack 4)
"
If you receive this message, then connection could not be established:
"
COULD NOT CONNECT TO SQL SERVER

SQLState: 08001 Native Error: 6
Info. Message: [Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL server not found.

SQLState: 01000 Native Error: 2
Info. Message: [Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionOpen (CreateFile()).
"

No comments: