Transactional Replication – Configuring Distributor

Lets Discuss the steps to Configure Distributor in detail.
In this article I am using the Server SansuTest as the Distributor. The Distributor is configured from SSMS as follows :

Step1 : Connect to an instance (SansuTest) of SQL Server by using the SQL Server Management Studio (SSMS), navigate to the “replication” folder, right-click this folder, and choose Configure Distribution.

distconfig_image001

Step2 : You are greeted with the Configure Distribution Server welcome page. If you dont ever want to see this screen again, simply check the option to skip the introductory screen in the future.

distconfig_image002

Step3 : Next screen shows the Distributor Page, you need to select the option whether you want to configure a new distributor or configure replicaton to use an existing distributor. Since this is the 1st time I am configuring distributor I chose the 1st option.

distconfig_image003

Step4 : Since SQL server agent is required for replication you are prompted to set it start automatically in the SQL server agent start page as shown below.

distconfig_image004

Step5 : The next screen allows you to specify the snapshot folder where data and schema of the published database will be stored. By default, the snapshot folder is called ReplData and is created within the directory where the current SQL Server instance is installed.

distconfig_image005

Notice the warning in the dialog box, indicating that the current directory doesnt support pull subscriptions. To use pull subscriptions, you need a network folder for storing snapshots. Because both publisher and subscriber instances of SQL Server in this example will reside on the same computer, I can safely disregard this message, and simply click Next.

Step6 : The following screen allows for configuring the distribution databases name and the location for its data and transaction log files. By default, the distribution database is called Distribution; you can modify the name if you have a compelling reason to do so. For example, if you have dozens or hundreds of publications, you might want to have multiple distribution databases, with descriptive names for each one. The wizard will use the default location for database and log files.

distconfig_image006

Step7 : The next screen enables servers to use the current distributor when theyre configured as publishers . This screen has a couple of interesting options. First, if you click the ellipsis (…) button next to a publisher, youll get a dialog box that allows you to configure the log reader agents security credentials as well as the snapshot folder for this publisher as shown below.

distconfig_image007

Second, the Add button allows you to add a SQL Server or Oracle publisher. This feature is worth your attention because using the distribution database for an Oracle publisher wasnt available in previous versions.

Step8 : After youve enabled the publishers, you can set a password for remote publishers. You must enter the same password twice. SQL Server 2005 allows the administrator to enforce password policies and password expiration. Hence, the wizard warns you that the password you enter for a remote publisher must meet the password policy requirements.

distconfig_image008

Step9 : After you click Next on this screen, you can configure distribution right away, save the script for later execution, or perform both actions. If you choose to save the script, youll be asked for the location where you want to save the file.

distconfig_image009

distconfig_image010

Step10 : At this point, the wizard presents a synopsis of the steps its about to undertake; once you click Finish, the wizard will create the script for adding a distributor and/or save the script, depending on what you specified.

distconfig_image011

Step11 : Once you click Finish the Distributor configuration process begins as shown in the below screenshot. If there is any errors you can see them in the screen.

distconfig_image012

The script created in Step9 will be as follows,

/****** Scripting replication configuration for server SANSUTEST. Script Date: 10/19/2007 5:17:07 PM ******/
/****** Please Note: For security reasons, all password parameters were scripted with either NULL or an empty string. ******/
/****** Installing the server SANSUTEST as a Distributor. Script Date: 10/19/2007 5:17:07 PM ******/
USE master
EXEC sp_adddistributor @distributor = N'SANSUTEST', @password = N''
GO
EXEC sp_adddistributiondb @database = N'Distribution', @data_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQLData', @log_folder = N'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQLData', @log_file_size = 2, @min_distretention = 0, @max_distretention = 72, @history_retention = 48, @security_mode = 1
GO
USE [Distribution]
IF (NOT EXISTS (SELECT * FROM sysobjects WHERE name = 'UIProperties' AND TYPE = 'U '))
CREATE TABLE UIProperties(id INT)
IF (EXISTS (SELECT * FROM ::fn_listextendedproperty('SnapshotFolder', 'user', 'dbo', 'table', 'UIProperties', NULL, NULL)))
EXEC sp_updateextendedproperty N'SnapshotFolder', N'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQLReplData', 'user', dbo, 'table', 'UIProperties'
ELSE
EXEC sp_addextendedproperty N'SnapshotFolder', 'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQLReplData', 'user', dbo, 'table', 'UIProperties'
GO
EXEC sp_adddistpublisher @publisher = N'SANSU', @distribution_db = N'Distribution', @security_mode = 1, @working_directory = N'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQLReplData', @trusted = N'false', @thirdparty_flag = 0, @publisher_type = N'MSSQLSERVER'
GO
EXEC sp_adddistpublisher @publisher = N'SANSUTEST', @distribution_db = N'Distribution', @security_mode = 1, @working_directory = N'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQLReplData', @trusted = N'false', @thirdparty_flag = 0, @publisher_type = N'MSSQLSERVER'
GO

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *