• Replication

    Remove replication completely 15

    Remove replication completely --https://jonathancrozier.com/blog/sql-server-replication-how-to-completely-remove-replication /* --on sub -- Remove replication objects from the subscription database on MYSUB. DECLARE @subscriptionDB AS sysname SET @subscriptionDB = N'Muthu_Replica' -- Remove replication objects from a subscription database (if necessary). USE master EXEC sp_removedbreplication @subscriptionDB GO */ --on pub --Manually remove subscriber --Manually remove publication -- Declare and set variables. DECLARE @distributionDB SYSNAME; DECLARE @publisher SYSNAME; DECLARE @publicationDB SYSNAME; SET @distributionDB = N'distribution'; -- CHANGE THIS TO THE DISTRIBUTION DATABASE NAME. SET @publisher = N'node1'; -- CHANGE THIS TO THE PUBLISHER NAME. SET @publicationDB = N'muthu'; -- CHANGE THIS TO THE PUBLICATION DATABASE NAME. -- Remove all replication objects from the publication database. USE muthu…

  • Replication

    Change Snapshot files C to D Drive 13

    Change the snapshot location of all publication You can change the snapshot location without having to perform a re-initialization. The only caveat to this is you do need to generate a new snapshot. This snapshot will not be applied to your subscribers, but has to go through the generation process. I recommend doing this at night or weekends to minimize the impact of the snapshot agent locking tables and contention on the publisher database.   Change snapshot location for all publication   /*Change path will generate new snapshot BCP file in the new location but this will not apply into subscription*/   USE distribution exec sp_changedistpublisher @publisher = ‘Node1’, @property…

  • Replication

    Replication important notes 12

    Tuning and Troubleshooting Transactional Replication – Kendal Van Dyke From this video – https://www.youtube.com/watch?v=UBdAAvMMGwo Types can be configured: Central publisher (One Pub & DIS and multiple subscribers) – Common used Central subscriber (On Sub, many DIS and many Bub) – This is mostly for data warehouse Republishing subscriber (Pub –> Dis àSub/Pub àDIS àmultiple subscriber) – Ex: Pub & DIS are in datacentre 1 & multiple subscriber in DC 2   Replication agent will not use SQL memory, it will use other buffer cache maybe OS or within SQL. It is recommended to have separate Publisher and Distributer for high transaction databases. For every DML command each transaction from publisher to subscriber will…

  • Replication

    Use backup to initialize without drop Publication Subscription 11

    Use backup to initialize without drop Publication Subscription Test – For existing Replication which was initialized using snapshot files, remove both publication (Script out Pub) and subscription and try it , which is configured by using snapshot method. Better script out Publication and distributor. Both removing only subscription (OR) publication and subscription – both are working. Drop subscription from the publication and remove the publication. While creating the publication we need to change parameter @sync_method = N’concurrent’ to @sync_method = N’native’ Try add new table in GUI and start the snapshot agent and check –Working Try adding new table by using sp_addarticle  (Do not run sp_refreshsubscriptions) T-SQL for single article and…

  • Replication

    Remove only subscription Recreate New Reinitialize 10

    Test 2 For existing Replication which was initialized using snapshot files, remove only subscription and test. Try with existing publication initialize from backup and add table from GUI and T-SQL. Try add new table in GUI and start the snapshot agent and check –Working Try adding new table by using sp_addarticle  (Do not run sp_refreshsubscriptions) T-SQL for single article and start the snapshot agent and check – Working Note: Only issue if we leave all tables in subscriber database after the restoration, if you want to replicate later remaining tables that’s not replicating it. If you drop tables in subscriber and add it in the replication it is working. Add only single table…