Remove and add publications in SQL Server replication without initializing all items

Source: Internet
Author: User

Original: Remove and add publications in SQL Server replication without initializing all items

--If you "Prohibit schema changes" in advance, the new columns will not automatically add a large release, you should use Sp_articlecolumn to add the column exec sp_changepublication @publication = N ' publication ', @ property = N ' Replicate_ddl ', @value = 0--"Remove and add the publication without initializing all items, but the added item must be initialized"--Disallow anonymous access to exec sp_changepublication ' Publication ', ' allow_anonymous ', false go--Disable immediate update of EXEC sp_changepublication ' publication ', ' Immediate_sync ', false go-- Terminates a single item copy (the table is in the normal operation of the publication, the subscription should prohibit the operation) Exec sp_dropsubscription @publication = n ' publication ', @article = n ' article ', @subscriber = N ' Subscriber ', @destination_db = N ' destination_db ' go--delete the item from the publication (the interface operation will reinitialize so the project) Exec sp_droparticle @publication = n ' publication ', @article = n ' article ' go--add items to the release (@schema_option reference personal requirements change) Exec sp_addarticle @publication = ' Publication ', @article = n ' article ', @source_object = n ' article ', @source_owner = n ' dbo ', @schema_option = 0x0000000008037 Cdfgo--Add an unpublished column (add more columns to a published table, not typically) Exec sp_articlecolumn @publication = ' publication ', @article = N ' article ', @column = n ' column ', @operation = N ' Add ' go--for row filtering (for filtering publications) Exec sp_articlefilter @publication =n ' publication ', @article = n ' article ', @filter_name = N ' fltr_article_1__1 ', @filter_clause = n ' id% 2 = 0 ' GO--row filtering (used to filter the hair Cloth) Exec Sp_articleview @publication = n ' publication ', @article = n ' article ', @view_name = N ' sync_article_1__1 ', @filter_cl Ause = N ' id% 2 = 0 ' GO-Refresh subscription to add Project exec sp_refreshsubscriptions ' publication ' GO--start Snapshot Agent (Initialize new project) Exec Sp_startpublication  _snapshot ' publication ' GO

Remove and add publications in SQL Server replication without initializing all items

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.