SQLServer 移除和添加發布而不初始化所有項目,sqlserver移除

來源:互聯網
上載者:User

SQLServer 移除和添加發布而不初始化所有項目,sqlserver移除

--若提前“禁止架構更改”,新增的列不會自動添加大發布,此時應使用 sp_articlecolumn 添加列EXEC sp_changepublication @publication = N'publication', @property = N'replicate_ddl', @value = 0--【移除和添加發布而不初始化所有項目,但是添加的項目須初始化】--禁止匿名訪問Exec sp_changepublication 'publication','allow_anonymous',false GO --禁止立即更新Exec sp_changepublication 'publication','immediate_sync',false GO --終止單個項目複製(該表在發布可正常操作,訂閱應禁止操作)Exec sp_dropsubscription @publication = N'publication', @article = N'article', @subscriber = N'subscriber', @destination_db = N'destination_db'GO--從發布中刪除項目(介面操作將會重新初始化所以項目)Exec sp_droparticle @publication = N'publication', @article = N'article'GO--添加項目到發布中(@schema_option 參考個人要求更改)Exec sp_addarticle @publication = 'publication', @article = N'article', @source_object = N'article', @source_owner = N'dbo',@schema_option = 0x0000000008037CDFGO --添加未發布的列Exec sp_articlecolumn @publication = 'publication' ,@article = N'article',@column = N'column',@operation = N'add'GO--進行行篩選(用於篩選發布)Exec sp_articlefilter @publication = N'publication', @article = N'article', @filter_name = N'FLTR_article_1__1', @filter_clause = N'id % 2 = 0'GO --進行行篩選(用於篩選發布)Exec sp_articleview @publication = N'publication', @article = N'article', @view_name = N'SYNC_article_1__1', @filter_clause = N'id % 2 = 0'GO --重新整理訂閱以添加項目Exec sp_refreshsubscriptions 'publication' GO --啟動快照代理(初始化新增的項目)Exec sp_startpublication_snapshot 'publication'GO 

相關文章

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.