WordsOnTech

Understanding Files created by Replication Snapshot Agent

In Previous article, we discussed – Where Are various Replication Agent Jobs Running ? This is very important for quick troubleshooting of replication issues.

In this article, we will try to understand various files created by Snapshot Agent when a Snapshot is created. If we go to snapshot folder (Check location in Publication Properties), we could see various file generated there.

We know that a publication might contain tables, stored procedures ,views, user defined functions , all these are called articles. Snapshot folder contains various files for each article.

Try opening these files (other than .BCP file) in notepad to see the code of each file and it will give real insight. I would also suggest to play with various options for articles in publication properties and then observe change in code of these files. It would be real fun.

For Tables
1.      .PRE (DROP commands): It first drops foreign keys, if any, for that table and then drops that table.
2.     .SCH (create table & custom SPs) : This file contains the creation script for the article to be replicated. This also contain code for three custom procedures for each table article . Here Custom SPs are INSERT, DELETE, UPDATE Procedures created for each table article through which corresponding operations are performed at subscriber table to have data in sync with publisher table.
3.     .IDX (indexes and constraints):  This contain the indexes and constraints on the tables to be created at the subscriber.
4.     .BCP (data) : This contain the actual table data to be inserted into the tables at the subscriber. There might be multiple BCP files for one article based in size of table.
For SPs
1.     .PRE(drop command)
2.    .SCH(create procedure script)
Statement in (PRE) depends on options selected in article property. By default option for an article is ‘DROP and Re-create’ so it would be a drop statement.
SCH file for table/SP would also depend on many options for that particular table/SP article.

Please share your inputs if any.

Happy Learning !

Exit mobile version