Skip to content

wacharakiat/codesanook-sql-server-replication-setup-script

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic replication presentation (Google slide)

To use this example

  • Launch a new PowerShell terminal.
  • Start SQL Server docker containers.
  • CD to docker folder.
  • Create a new file 'sa_password.secret' and put a strong sa's password to this file. Please make sure that you use LF line feed.
  • Run a docker-compose command with a following command.
    docker-compose up
  • Wait for a while and you will have publisher, distributor and subscriber instances.
  • You can connect to each SQL Server instance with this information .
  • publisher: localhost, 1433
  • distributor: localhost, 1434
  • subscriber: localhost, 1435

Create a new database and setup replication

  • Launch a new PowerShell terminal.
  • CD to the root of the project.
  • Execute the following commmand to setup replication.
    .\Install-Replication.ps1
  • After setup successfully, you will have a new database with replication.

Testing a replication

  • Run New-DatabaseRecord.ps1. It will excute stored proc to insert a new record to publisher and then select records from subscription database.
    .\New-DatabaseRecord.ps1

About

example scripts to create SQL Server replication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TSQL 51.7%
  • PowerShell 46.0%
  • Shell 1.2%
  • Dockerfile 1.1%