Thursday, November 7, 2019

Replication Regular activities...

How to Stop Replication on select article(s)

If you want to stop replication on certain articles follow these steps.
  1. Open SSMS, connect to the instance that is running the publication (source) that you want to remove articles from replication.
  2. Expand Replication, then Local Publications. Look for the publication you want to stop replicating those articles. Right click on the publication and click Properties.
  3. How TO for replication
  4. Click on Articles and check Show only checked articles in the list.
    • Uncheck the article(s) you no longer want to replicate.
    • How TO for replication
    • If a warning pops up, click Yes.
    • Please Note this will cause your snapshot to be invalid. So a new one will have to be created and this can cause the article to be locked until the data is BCP’ed out (copied to a file on the drive). This does not take that long. However, the re-loading of those articles into the subscription may take time since the new article(s) will have to be reloaded.
      How TO for replication
    • If you see this pop-up, click Mark For Reinitialization.
    • How TO for replication
      -This will cause the subscriber to be reinitialized.
      How TO for replication
    • Click OK.
    • This does NOT delete the article from the subscriber (destination). So, any new records that are added to the source table do NOT get replicated to the subscriber.
  5. Verify changes.

How to Restart Replication on articles after a schema change

If you stop replication (remove the article from the publication) for a table you want to make schema changes to and then you want to add it back into replication, follow these steps. Again if Alter table is used this is not necessary but if you are modifying millions of records it might be a better approach to do this then add it back.
  1. Open SSMS, connect to the instance that is running the publication (source) and the source where you made schema changes to.
  2. Add the article back into replication.
  3. If the article(s) existed on the subscriber, no need to delete these article(s) first.
  4. Expand Replication, then Local Publications. Look for the publication from which you want to stop replicating those articles. Right click on the publication and click Properties.
  5. How TO for replication
  6. Click on Articles and uncheck Show only checked articles in the list.
    • If you see a red circle with a line through it, that means the article does NOT have a primary key and you need to add one. Close the window and create a new primary key.
    • -Example: alter table Table_1 add primary key (Test)
      How TO for replication
    • Go back into the properties for the publication (steps 3-4 from above)
    • -Check the article(s) you want to add to replication.
      How TO for replication
      -Click OK.
  7. Right click on the publication you want to push the new article(s) you just added to the publication. Click on View Snapshot Agent Status.
  8. How TO for replication
  9. Click on Start to start the snapshot.
    • Please Note a new snapshot will have to be created and this can cause article(s) to be locked until the data is BCP’ed out (copied to a file on the drive). This does not take that long.
    How TO for replication
  10. After a short time, the new article(s) will be synced to the subscriber without initializing all previously synched articles with transactional replication. With snapshot replication, all tables will be refreshed so the create date(s) will be the same.
  11. Verify changes.

How to add a new article to the existing Publication

If you create a new table and want to add it to the existing publication, follow these steps:
  1. Open SSMS, connect to the instance that is running the publication (source) that you want to add article(s) to replication.
  2. Verify that the table you want to add exists with a Primary Key.
  3. img
  4. Expand Replication, then Local Publications. Look for the publication you want to add those articles to replication. Right click on the publication and click Properties.
  5. How TO for replication
  6. Click on Articles and uncheck Show only checked articles in the list.
    • If you see a red circle with a line through it, that means the table does NOT have a primary key and you need to add one. Close the window and create a new primary key.
    • -Example: alter table Table_1 add primary key (Test)
      How TO for replication
    • Go back into the properties for the publication (steps 3-4 from above).
    • -Check the new article(s) you want to add to replication.
      How TO for replication
      -Click OK.
  7. Right click on the publication you want to push the new article(s) you just added to the publication. Click on View Snapshot Agent Status.
  8. How TO for replication
  9. Click on Start to start the snapshot.
  10. How TO for replication
  11. After a short time, the new article(s) will be synced to the subscriber without initializing all previously synched articles.
  12. How TO for replication
    8. Verify changes...

No comments:

Post a Comment

COMMON SQL SERVER BACKUP FAILURE ERRORS AND ISSUES

  One of the most common task for a DBA’s are to perform installation of new SQL Server versions and installing patches. Most often or not e...