SQLServer remove and add releases without initializing all projects.

Source: Internet
Author: User

SQLServer remove and add releases without initializing all projects.

-- If you disable schema change in advance, the newly added columns will not automatically add a large distribution. In this case, use sp_articlecolumn to add the column EXEC sp_changepublication @ publication = N 'publication ', @ property = n' replicate _ ddl ', @ value = 0 -- [remove and add a release without initializing all projects, however, the added project must be initialized. -- disable anonymous access to Exec sp_changepublication 'publication ', 'Allow _ anonus us', and false GO -- disable immediate update of Exec sp_changepublication 'publication ', 'Immediate _ sync', false GO -- terminate the replication of a single project (the table can be normally operated upon publishing, and the subscription should be prohibited) Exec sp_dropsubication @ publication = n' publication ', @ article = N 'Article', @ subscriber = n' subscriber ', @ destination_db = n'destination _ db' GO -- delete a project from the release (the project will be reinitialized by the interface operation) Exec sp_droparticle @ publication = n'publication ', @ article = N 'Article' GO -- add a project to the release (@ schema_option can be changed according to personal requirements) Exec sp_addarticle @ publication = 'publication ', @ article = N 'Article ', @ source_object = N 'Article', @ source_owner = N 'dbo', @ schema_option = 0x0000000008037CDFGO -- add unpublished column Exec sp_articlecolumn @ publication = 'publication ', @ article = n'article', @ column = n'column', @ operation = n'add' GO -- filters rows (used to filter publishing) exec sp_articlefilter @ publication = N 'publication', @ article = N 'Article', @ filter_name = N 'fltr _ article_1 _ 1 ', @ filter_clause = n'id % 2 = 0' GO -- performs row filtering (used for filtering and publishing) Exec sp_articleview @ publication = N 'publication ', @ article = N 'Article ', @ view_name = n' SYNC _ article_1 _ 1 ', @ filter_clause = n'id % 2 = 0' GO -- refresh the subscription to add the project Exec sp_refreshsubscriptions 'publication' GO -- start the snapshot proxy (initialize the new project) Exec sp_startpublication_snapshot 'publication' GO

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.