我在事务复制中删除了一些我的出版物。 我使用下面的脚本,与我在文档中找到的相反,它不会使该出版物的快照无效。
我通常通过运行快照代理来测试它,快照代理在大约12秒后告诉我不需要运行完整快照。
如何在不运行快照的情况下测试快照是否良好?
我不想运行它,因为如果它不好,我不想在中间停止它,我不想在办公时间运行它。
感谢和问候
马塞洛
-- the script to remove an article from the replication is: (1) and (2) below:
-- to be run at the publisher (in this case SERVER MYSERVER - DATABASE MYDATABASE
-- (1)
--use [MYDATABASE]
--exec sp_dropsubscription @publication = N'MYPUBLICATION', @article = N'tblTaxTransaction', @subscriber = N'all', @destination_db = N'all'
--GO
-- (2)
--use [MYDATABASE]
--exec sp_droparticle @publication = N'MYPUBLICATION', @article = N'tblTaxTransaction', @force_invalidate_snapshot = 1
--GO
--[ @force_invalidate_snapshot = ] force_invalidate_snapshot
--Acknowledges that the action taken by this stored procedure may invalidate an existing snapshot.
--force_invalidate_snapshot is a bit, with a default of 0.
--0 specifies that changes to the article do not cause the snapshot to be invalid.
--If the stored procedure detects that the change does require a new snapshot, an error occurs
--and no changes are made.
--1 specifies that changes to the article may cause the snapshot to be invalid,
--and if there are existing subscriptions that would require a new snapshot,
--gives permission for the existing snapshot to be marked as obsolete and a new snapshot generated.
答案 0 :(得分:1)
我没有找到任何答案,可能答案是没有办法通过T-SQL来做,但是, 我已经了解到将immediate_sync和allow_anonymous选项设置为false的事实有助于在每次向发布添加或删除文章时不必生成快照。
- >检查immediate_sync和allow_anonymous选项
如果它们设置为1,则每次添加新文章时都会导致应用整个快照。
您可以使用sp_changepublication禁用它们:
Exec sp_changepublication
@publication = ' publication db'
@property=N'allow_anonymous',
@value='false'
Go
Exec sp_changepublication
@publication = ' publication db'
@property=N'immediate_sync',
@value='false'
go