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.
Determining Values for the Command Files
The StopRepl.cmd and StopRepl_WinAuth.cmd files run SMA_STOPREPL.sql and SMA_DELPULL.sql through SQL Server Management Studio. Results are logged in SMA_STOPREPL.log and SMA_DELPULL.log in the \<Output Directory>\SAM\Log\ directory.
The Output Directory was configured during installation. For more information, refer to File Locations in the Concepts online help.
StopRepl.cmd variables:
- %1: Directory path of the parent directory to the OpCon \<Configuration Directory> on the Secondary SAM application server. Exclude the trailing backslash and enclose in double quotes (e.g., "C:\ProgramData")
- %2: The sa password for the SQL Server hosting the Publishing OpCon database
- %3: The sa password for the SQL Server hosting the Subscribing OpCon database
StopRepl_WinAuth.cmd variable:
- %1: Directory path of the parent directory to the OpCon \<Configuration Directory> on the Secondary SAM application server. Exclude the trailing backslash and enclose in double quotes (e.g., "C:\ProgramData")
Modifying the Stop Replication Command File
By default, both command files run only SMA_STOPREPL.sql. For push subscriptions, this default is sufficient. For pull subscriptions, modify StopRepl.cmd to also run SMA_DELPULL.sql. For both subscription types, modify the event string at the end of the command file to enable failover notification.
Modify the Stop Replication Command File
On the Secondary SAM application server:
Log in as a Windows user with Local Administrative Rights
Right-click Start and select Explore
Browse to the \<Configuration Directory>\Utilities\Database\ directory
noteThe Configuration Directory location depends on your installation. For more information, refer to File Locations in the Concepts online help.
Right-click the appropriate command file:
- SQL Authentication: StopRepl.cmd
- Windows Authentication: StopRepl_WinAuth.cmd
Select Edit to open the file in a text editor
Replace all command file variables (%1, %2, etc.) with the correct values from Determining Values for the Command Files
If using a pull subscription, remove the rem characters from the eighth line that runs SMA_DELPULL.sql
On the last line:
- Replace \<Severity> with the desired Windows Event Severity (I=Informational, W=Warning, E=Error)
- Replace \<EventID> with a one- to five-digit notification ID
- Replace \<UserID> with a valid OpCon User Login ID
- Replace \<EventPassword> with the external event password for the User Login ID
Running the Stop Replication Command File
- For manual failover, refer to Manual Failover to the Subscribing Database Server
- For automatic failover, configure the Secondary SMAServMan to run the appropriate command file. Refer to Automatic Failover to the Subscribing Database Server
Configuration Options
| Setting | What It Does | Default | Notes |
|---|---|---|---|
| %1 | Directory path of the parent directory to the OpCon \ on the Secondary SAM application server. | — | — |
| %2 | The sa password for the SQL Server hosting the Publishing OpCon database | — | — |
| %3 | The sa password for the SQL Server hosting the Subscribing OpCon database | sufficient | — |
FAQs
Q: How many steps does the Manual Setup for Microsoft SQL Replication procedure involve?
The Manual Setup for Microsoft SQL Replication procedure involves 86 steps. Complete all steps in order and save your changes.
Q: What does Manual Setup for Microsoft SQL Replication cover?
This page covers Requirements, Publishing and Subscribing Servers, Configuring the Subscribing Server for Failover.
Glossary
SMAServMan (SMA Service Manager): Manages the starting, stopping, and restarting of all OpCon server programs. Monitors configured applications and restarts them automatically if they fail unexpectedly.
SAM-SS (SAM and Supporting Services): The collective term for the OpCon server-side processing programs: SAM, SMANetCom, SMA Notify Handler, SMA Request Router, and SMA Start Time Calculator.
SAM (Schedule Activity Monitor): The logical processor for OpCon workflow automation. SAM monitors schedule and job start times, dependencies, and user commands to determine job execution timing, and processes OpCon events.
Notification: A message sent by the SMA Notify Handler when a Machine, Schedule, or Job changes to a specific status. Notifications can be delivered as emails, text messages, Windows Event Log entries, SNMP traps, or other formats.
Resource: A numeric variable in OpCon representing a finite pool. Jobs can be configured to require a set number of resource units to run, limiting concurrent executions and preventing resource contention.
Role: A named security profile in OpCon that groups privileges together. Roles are assigned to user accounts to control which features, schedules, jobs, machines, and administrative functions a user can access.
Machine: A platform defined in the OpCon database that has an agent installed. OpCon routes job execution requests to machines via SMANetCom, and machines report job completion status back to SAM.
Schedule: A named container for jobs in OpCon, built for a specific date to create that day's automation. Schedules define build settings, frequencies, and the jobs that run within them.