One-Way Transactional
Replication in SQL Server
Transactional Replication in SQL Server is used to replicate data continuously
from one database (Publisher) to another (Subscriber). It is ideal for scenarios
requiring high throughput and low latency.
This document details the step-by-step configuration of one-way transactional
replication, including prerequisites, setup, common issues, and solutions.
1. Prerequisites
Hardware/Software
Two machines or VMs on the same network.
SQL Server 2019 Standard Edition (or higher) installed on both systems.
SQL Server Agent running on both Publisher and Subscriber.
Network Requirements
Ensure both machines can ping each other.
Use static IPs or hostnames with proper resolution.
SQL Server Configuration
Enable TCP/IP in SQL Server Configuration Manager.
Set static port (e.g., 1433) under Protocols for MSSQLSERVER > TCP/IP >
IPAll.
Ensure SQL Server listens on port 1433:
netstat -an | findstr 1433
Login Requirements
Ensure SQL Server Agent runs with a domain account or local account with
appropriate privileges.
www.linkedin.com/in/daniyaldba/ +923408801269 [email protected]
Create SQL logins/users on both Publisher and Subscriber with necessary
permissions.
2. Step-by-Step Configuration
Step 1: Create the Publisher Database
1. Open SSMS on Publisher.
2. Create a new database testDB.
3. Create required tables and insert data to test replication.
Step 2: Enable the Distributor
1. Expand Replication > Right-click Local Publications > Configure
Distribution.
2. Follow wizard to configure Distributor on Publisher (can also be a remote
machine).
Step 3: Create the Publication
1. Right-click Local Publications > New Publication.
2. Select the testDB database.
3. Choose Transactional Publication.
4. Select the tables you want to replicate.
5. Create a Snapshot Agent schedule.
6. Specify a Publication Name.
7. Finish the wizard.
Step 4: Create the Subscriber Database
1. On the Subscriber machine, open SSMS.
2. Create a new empty database testDBSubscriber.
Step 5: Create the Subscription
1. Go back to Publisher SSMS.
2. Right-click the publication > New Subscriptions.
3. Select Push Subscription.
4. Choose Subscriber instance and testDBSubscriber.
5. Configure the distribution agent security:
www.linkedin.com/in/daniyaldba/ +923408801269 [email protected]
o Use a SQL login or Windows account with permissions on
Subscriber.
6. Choose when to run the distribution agent.
7. Finish the wizard.
Step 6: Start Snapshot Agent
1. Go to Replication > Local Publications.
2. Right-click your publication > View Snapshot Agent Status.
3. Click Start Agent.
3. Common Issues and Solutions
Issue 1: SQL Server Agent Not Running
Error: Agent not executing jobs. Solution:
Open SQL Server Configuration Manager > Start SQL Server Agent.
Issue 2: Port Connectivity
Error: Cannot connect to Subscriber. Solution:
Ensure SQL Server port (1433) is open.
Disable firewall or add an exception.
Issue 3: Snapshot Agent Proxy Error
Error: "Error authenticating proxy Dangchou\dangc" Cause: Incorrect Windows
credentials. Solution:
Use correct password or create new proxy user.
Run: runas /user:machine_name\\username cmd
Ensure the user has permissions on both SQL Server and file system.
Issue 4: Tables Not Visible on Subscriber
Cause: Snapshot agent not run or failed. Solution:
View Snapshot Agent Status.
Start Agent manually.
Check for errors in SQL Server Agent > Job History.
www.linkedin.com/in/daniyaldba/ +923408801269 [email protected]
Issue 5: Domain vs. Workgroup Conflict
Error: Proxy authentication fails. Cause: Workgroup computer using domain-
style credentials. Solution:
Ensure local user credentials match.
Avoid fake domain names unless part of AD.
4. Post Setup Verification
Insert data into testDB on Publisher.
Verify that it automatically appears in testDBSubscriber.
Check Replication Monitor for latency and errors.
5. Optional Steps
Configure alerts or notifications for agent failures.
Periodically check snapshot and distribution agent status.
===================GOOD LUCK=============================
www.linkedin.com/in/daniyaldba/ +923408801269 [email protected]