WordsOnTech

Using Snapshot Replication for Schema Transfer/Refresh Only

Snapshot replication distributes data exactly as it appears at a specific moment in time and does not monitor for updates to the data. When synchronization occurs, the entire snapshot is generated and sent to Subscribers. The snapshot process (which creates a copy of all of the objects and data specified by a publication) is also commonly used to provide the initial set of data and database objects for transactional and merge publications.

Snapshot replication can be used to update the structure of tables in a database. For example, if a customer needs to update the schema of certain tables, they can set up a snapshot agent job to do this automatically. This job will remove the old tables and create new ones with the latest design/schema from the original database.

Previously, to move specific tables from one database to another, the customer needed to manually create scripts for the desired tables from the original database, delete these tables from the target database, and then use the scripts to recreate them in the new location. However, there’s a tool called sqlpackage.exe that can also perform this task, although it might seem complicated at first.

In this blog post, we will discuss on how to refresh only the schema using SQL server snapshot replication.  We will transfer schema of some tables from “AdventureWorks2022” database to  “AdventureWorks2022_Schema1” database using snapshot replication using below steps.

Now I added one column in [Person].[BusinessEntity] table in ‘AdventureWorks2022’ database and will show that it will be replicated to target database ‘AdventureWorks2022_Schema1’ once I will apply a fresh snapshot.

In below screenshot you can see that column ‘TestID’ has been replicated successfully.


Hope you will find this article helpful.
Happy Learning !!

Exit mobile version