{"id":15002773,"url":"https://github.com/madeiradata/replicationmanagementmechanism","last_synced_at":"2026-01-26T20:56:56.818Z","repository":{"id":221024611,"uuid":"753232891","full_name":"MadeiraData/ReplicationManagementMechanism","owner":"MadeiraData","description":"Use SQL Server database tables to manage and configure Transactional Replication, and set it up easily between publishers and subscribers using stored procedures","archived":false,"fork":false,"pushed_at":"2024-02-05T18:23:41.000Z","size":41,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T09:43:20.050Z","etag":null,"topics":["microsoft-sql-server","mssql","mssql-replication","mssqlserver","replication","sql-server","sqlserver"],"latest_commit_sha":null,"homepage":"https://madeiradata.com","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MadeiraData.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-05T18:13:17.000Z","updated_at":"2024-06-11T16:07:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d3e4b1f-b032-4745-bed4-d04157261202","html_url":"https://github.com/MadeiraData/ReplicationManagementMechanism","commit_stats":null,"previous_names":["madeiradata/replicationmanagementmechanism"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FReplicationManagementMechanism","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FReplicationManagementMechanism/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FReplicationManagementMechanism/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadeiraData%2FReplicationManagementMechanism/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MadeiraData","download_url":"https://codeload.github.com/MadeiraData/ReplicationManagementMechanism/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247273981,"owners_count":20912027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["microsoft-sql-server","mssql","mssql-replication","mssqlserver","replication","sql-server","sqlserver"],"created_at":"2024-09-24T18:52:23.143Z","updated_at":"2026-01-26T20:56:56.788Z","avatar_url":"https://github.com/MadeiraData.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transactional Replication Management Mechanism for SQL Server\n\nUse SQL Server database tables to manage and configure Transactional Replication, and set it up easily between publishers and subscribers using stored procedures.\n\n### Huge Credit and Thanks to:\n- Kostya Fridman\n- Ivo Ivanov\n- Martin Nikolov\n- Gergana Bivolarska\n\n### Overview\n- We have a mechanism to create a replication of a database\n- The mechanism would normally be located in a Configurations DB, Replication schema\n- Consists of several tables, that hold the configuration of the replication and several stored procedures to recreate the replica\n- Definitions are being held in `SELECT * FROM Configuration.[Replication].Definitions AS d`\n\n### To recreate a replica from scratch, execute the following SP's. All of which expect the parameters:\n  - `@DatabaseName` - The name of the database that we want to replicate from the definitions table\n  - `@SubscriberInstanceName` - The name of the subscriber to which we want to replicate, again from the definitions table\n  - `EXEC Configuration.[Replication].Step1_DistributerCreateAllObjects` - outputs a script that needs to be executed on the Distributor\n  - `EXEC Configuration.[Replication].Step2_ArticlesVerification` - prints out tables that are missing in the article definitions. Need to take the script from one of the columns, based on the action you want to achieve:\n    - If you want the article to be included, grab the value from `IncludeArticles` column and execute it in another window\n    - If you want the article not to be included, grab the value from `ExcludeArticles` column and execute it in another window\n    - If you want to add just this single article to an already existing replication, grab the value from `ExecAddSingleArticle` and run it in another window (check below for a full description on how to add a new article to an already running replication)\n  - `EXEC Configuration.[Replication].Step3_RunPublisherProcess` - creates the publication, adds the articles, removes from replication columns that are bigger than 1000 characters, and creates the database backup to initialize the subscriber\n  - `EXEC Configuration.[Replication].Step4_SubscriberCleanObjects` - outputs a script that needs to be executed on the subscriber. Restore the DB from the backup created in the previous step and prepares it for the subscription\n  - `EXEC Configuration.[Replication].Step5_PublisherStart` - starts the replica\n- The replica is initialized with `immediate_sync = false`. Schema changes done on the publisher are replicated to the subscriber\n\n### When a new table is added to the publisher and you need to add it for replication:\n  - Create the table also on the subscriber\n    - If the table has an IDENTITY column, its definition should have the property \"NOT FOR REPLICATION\"\n    - If the table has FK's, don't create them\n    - If the table has CK's, don't create them\n    - If the table has triggers, don't create them, or disable them after creation\n  - Stop the log reader job\n  - Sync the data between publisher and subscriber (one can use the Import/Export tool)\n  - Execute `EXEC Configuration.[Replication].Step2_ArticlesVerification`, grab the output from `ExecAddSingleArticle` column for the desired table and run it in a new window.\n  - Start the log reader job\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeiradata%2Freplicationmanagementmechanism","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadeiradata%2Freplicationmanagementmechanism","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeiradata%2Freplicationmanagementmechanism/lists"}