Manual Setup for Microsoft SQL Replication
Theme: Configure
Who Is It For? System Administrator
What Is It?
Manual setup for Microsoft SQL Replication configures the publisher, distributor, and subscriber roles needed for OpCon transactional replication. This approach is used when the automatic replication setup cannot be used or when the DBA prefers full control over the configuration steps.
Database replication improves SQL Server database availability using three roles: publisher, distributor, and subscriber. OpCon uses transactional replication to distribute data from the production database to the failover database. Data moves from the publisher to the distributor, then is either pushed to the subscriber by the distributor or pulled from the distributor by the subscriber.
This topic assumes the publisher and subscriber are distinct SQL Server instances on separate machines. The distributor may be on its own instance or share an instance with either the publisher or subscriber.
Requirements
Verify the following before attempting transactional replication on the Publishing OpCon Database Server:
- The OpCon database server must have Microsoft SQL Server or Enterprise edition installed
- The distributor's SQL Server version must be the same or later than the publisher's
- Both the Publishing and Subscribing OpCon databases must have the Recovery model set to Full
- The MSSQLSERVER service must run as a domain user with local administrative rights, not as system
Publishing and Subscribing Servers
The Publication Server contains the primary OpCon database (referred to as the "Publishing Database Server"). The Subscription Server contains a copy of the OpCon database (referred to as the "Subscribing Database Server").
Registering the Database Servers
If absent from the SQL Server group, register the publishing and/or subscribing database servers so SQL recognizes them.
Register Database Servers
On the desired database server:
To publish and Subscribing Servers, complete the following steps:
- Log in as a local administrative user
- Go to Start > All Programs > SQL Server Management Studio
- Select Database Engine in the Server type list
- Select the desired [OpCon Database Server] in the Server name list
- Select one of the following in the Authentication list:
- Windows Authentication to log in with the current Windows user with local administrative authority
- SQL Server Authentication, then enter sa in the Login field and the sa password in the Password field
- Select the Connect button
Register the Database Server
- Go to View > Registered Servers
- In the Registered Servers frame, expand Database Engine
- Right-click Local Server Groups and select New Server Registration
- Enter or select the server name in the Server name list
- If the server is not in the list, select <Browse for more...> and browse Local Servers or Network Servers to find it
- Select the server and select OK
- Select one of the following in the Authentication list:
- Windows Authentication to log in with the current Windows user with local administrative authority
- SQL Server Authentication, then enter sa in the Login field and the sa password in the Password field
- Select the Test button and confirm the connection is successful
- Select OK, then select Save
Publication
Set up the OpCon database as a publisher to produce the subscribing database.
Setting up a Publisher
Enable the Publisher
Log into SQL Management Studio on the Publishing Server, then:
-
Go to View > Object Explorer
-
In the Object Explorer frame, expand the Replication folder
-
Right-click Local Publications and select New Publication
-
On the New Publication Wizard welcome screen, select Next
-
If publishing has not yet been enabled for the server:
- On the Distributor screen, select the desired Distributor and select Next
- Select Yes, configure the SQL Server Agent service to start automatically and select Next
- Confirm the snapshot folder path and select Next
-
Select the OpCon Database and select Next
-
On the Publication Type screen, select Transactional Publication and select Next
-
On the Articles screen, select Tables under Objects to Publish and select Next
-
On the Filter Table Rows screen, select Next
-
On the Snapshot Agent screen, select Create a snapshot immediately and keep the snapshot available to initialize subscriptions and select Next
-
On the Agent Security screen, select Security Settings for the Snapshot Agent
-
On the Snapshot Agent Security screen, select Run under the SQL Server Agent service account
-
Select Using the following SQL Server login
-
Enter the Login name (preferably sa or equivalent) in the Login field
-
Enter and confirm the password in the Password and Confirm Password fields, then select OK
-
On the Agent Security screen, clear Use the security settings from the Snapshot Agent and select Next
-
On the Wizard Actions screen, select Create the publication and select Next
-
On the Complete the Wizard screen, enter a Publication name and select Finish
noteOn the Create Publications screen, the goal is to see "Success" with 0 Errors and 0 Warnings. If errors are present, rerun the New Publication Wizard.
-
Select Close
Subscription
Set up an additional database as a subscriber to produce the secondary database.
Setting up a Subscription
Deciding on a Subscription Type
Two subscription types are available: Push and Pull. Continuous fully supports both.
Use push subscriptions when:
- Data synchronizes on demand or on a recurring schedule
- Publications require near real-time data movement without polling
- Higher processor overhead at a Publisher with a local Distributor does not affect performance
- Easier centralized administration from the Distributor is needed
- The Distribution Agent or Merge Agent runs at the Distributor; optionally, you can run it at the Subscriber to offload agent processing while retaining some centralized administration benefits
Use pull subscriptions when:
- Subscription administration occurs at the Subscriber
- The publication has many Subscribers and running all agents at one site would be too resource-intensive
- Subscribers are autonomous, disconnected, or mobile and determine their own sync schedule
- Reducing processing overhead on the Distributor is a priority; the Distribution Agent or Merge Agent runs at the Subscriber
First Option: Setting Up a Push Subscription
Log into SQL Management Studio on the Publishing Server, then:
-
Go to the Object Explorer frame
-
Expand the Replication folder
-
Right-click Local Subscriptions and select New Subscriptions
-
Select Next
-
Leave Run all agents at the Distributor, <Server name> [push subscriptions] selected and select Next
-
If the secondary server is not available, select Add Subscriber > Add SQL Server Subscriber and enter the <Subscribing Server name>
-
Select the subscriber option, select the subscribing database in the Subscription Database list, and select Next
-
Select the ellipsis button (...)
-
Select Run under the SQL Server Agent service account
-
Select Using the following SQL Server login under Connect to the Subscriber
-
Enter the Login name (sa or equivalent), Password, and Confirm Password, then select OK
-
Select Next
-
Accept the Run Continuously default for the Agent Schedule and select Next
-
Select the Initialize option, select Immediately in the Initialize When list, and select Next
-
Select Create the subscription(s) and select Next
-
Select Finish, wait for successful completion, then select Close
Second Option: Setting Up a Pull Subscription
Log into SQL Management Studio on the Subscribing Server, then:
- Go to the Object Explorer frame
- Expand the Replication folder
- Right-click Local Subscriptions and select New Subscriptions
- Select Next
- On the Publication screen, select <Find SQL Server Publisher> in the Publisher list
- On the Connect to Server screen, select the server name, select SQL Server Authentication, enter the Login ID and password, then select Connect
- On the Publication screen, expand the database in the Databases and publications frame, select the publication, and select Next
- On the Distribution Agent Location screen, select Run each agent at its Subscriber [pull subscriptions] and select Next
- On the Subscribers screen, select the subscriber option and select the subscribing database in the Subscription Database list
- To create a new database: select <New Database...>, enter a Database name, select OK, and confirm the new database is selected
- To add an additional subscriber: select Add SQL Server Subscriber, then connect to the subscribing server using SQL Server Authentication. If the server is not listed, select <Browse for more>, select the Network Servers tab, expand Database Engine, select the server, and select OK
- Select Next
- On the Distribution Agent Security screen, select the ellipsis button (...) next to the first subscriber
- In the Distribution Agent Security window, leave Run under the following Windows account selected. Enter your domain account, password, and Confirm Password, then select OK
- Repeat for each subscriber and select Next
- Accept Run Continuously in the Agent Schedule list and select Next
- Select the Initialize option, select Immediately in the Initialize When list, and select Next
- On the Wizard Actions screen, select Create the Subscription and select Next
- Select Finish, wait for successful completion, then select Close
Verifying Replication
If refreshing manually in Management Studio, refresh before verifying replication.
Verify Replication
Log into SQL Management Studio on the Publishing Server, then:
- Go to the Object Explorer frame
- Expand the Replication folder
- Right-click Local Publications and select Open Replication Monitor
- Expand the publishing database
- Select the Publication to view status and performance details
- Select the Subscription to view additional status details, then select Close
- Select the Warning and Agents tab
- Select the Snapshot Agent to view all replicated transactions, then select Close
- Select Tracer Tokens
- (Optional) Select Insert Tracer to view replication latency, then select Close
- (Optional) Expand Databases and the subscribing database and review the tables to confirm replication, then select Close
Configuring the Subscribing Server for Failover
In the event of failover, the subscribing database must fully support OpCon processing and replication must cease.
Running the Database Upgrade Scripts
For information on running the Database Upgrade scripts, refer to Update Database in the Utilities online help.
Configuring Failover Scripts and the SMA Service Manager
Continuous provides two SQL scripts and a command file for stopping replication and disconnecting all users from the publishing database. These files are installed with the SAM-SS in the <Configuration Directory>\Utilities\Database\ directory.
The Configuration Directory location depends on your installation. For more information, refer to File Locations in the Concepts online help.