Skip to content

A flexible MS SQL Server data sync method to keep SQL databases in sync irrespective of the SQL Server edition used without using native Mirror/Replication methods.

Notifications You must be signed in to change notification settings

akhil850/MSSQL-Server-Data-Sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 

Repository files navigation

MSSQL Server Data Sync

Open Source Love svg1

Hello World.!

Hereby sharing a working method to perform table syncing between two MS SQL database server irrespective on the editions used.

Advantages

  1. Any MSSQL Edtions can be used.
  2. Automation via batch script keeping two databases in SYNC.

Requirements

  1. WCOM SqlBulkSync executable.

  2. Hron: Serialization format used for sync jobs.

  3. At Source/Destination Databases:

  • Same table schema and naming.

  • Change tracking is enabled at source DB.

  • A 'sync' schema present at destination DB.

Usage

  1. Create a Job. [Powershell/CMD]

SqlBulkSync.exe CREATETEMPLATE SyncJob.hron

  1. Modify SyncJob.hron asper requirements.

=SourceDbConnection

Data Source=sourceserver;Initial Catalog=SourceDatabase;User ID=userid;Password=password

=TargetDbConnection

Data Source=targetserver;Initial Catalog=DestinationDatabase;User ID=userid;Password=password

=Tables

dbo.Table1

=Tables

dbo.Table2

=BatchSize

1000

Note: For local Sync Jobs;

Example:: Data Source=localhost;Initial Catalog=TargetDatabase;Integrated Security=true;

  1. Enable Change tracking at Source Database. (SSMS or T-SQL Query)

USE SourceDatabase

GO

ALTER DATABASE SourceDatabase

SET CHANGE_TRACKING = ON

(CHANGE_RETENTION = 5 DAYS, AUTO_CLEANUP = ON);

GO

  1. Create 'sync' schema at Destination Database.

USE DestinationDatabase

GO

CREATE SCHEMA sync

GO

  1. Execute the Sync job [[Powershell/CMD]]

SqlBulkSync.exe PROCESS SyncJob.hron

Reserved

About

A flexible MS SQL Server data sync method to keep SQL databases in sync irrespective of the SQL Server edition used without using native Mirror/Replication methods.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published