이것은 내가 엉망인 출판물을 가질 때 일반적으로하는 일입니다.
그것은 조금 추악하지만 다른 환경에서 여러 번 나를 위해 일했습니다. 무엇이 원인입니까? 때로는 이해하기 어려우며, 처음부터 시작하는 것이 가장 좋지만, 심지어 현재 출판물에서 결함이있는 부분 을 정리해야 all
합니다 residuals
.
컨텍스트에 넣으려면 :
이것이 복제 모니터에서 보는 것입니다.
그리고 T-SQL을 사용하여 자체 복제 모니터를 사용할 때 :
DECLARE @cmd NVARCHAR(max)
DECLARE @publisher SYSNAME, @publisher_db SYSNAME, @publication SYSNAME, @pubtype INT
DECLARE @subscriber SYSNAME, @subscriber_db SYSNAME, @subtype INT
DECLARE @cmdcount INT, @processtime INT
DECLARE @ParmDefinition NVARCHAR(500)
DECLARE @JobName SYSNAME
DECLARE @minutes INT, @threshold INT, @maxCommands INT, @mail CHAR(1) = 'N'
SET @minutes = 60 --> Define how many minutes latency before you would like to be notified
SET @maxCommands = 80000 ---> change this to represent the max number of outstanding commands to be proceduresed before notification
SET @threshold = @minutes * 60
IF OBJECT_ID ('TEMPDB..#Replication_Qu_History') IS NOT NULL
DROP TABLE #Replication_Qu_History
IF OBJECT_ID ('TEMPDB..##PublicationInfo') IS NOT NULL
DROP TABLE ##PublicationInfo
IF OBJECT_ID ('TEMPDB..#PublisherInfo') IS NOT NULL
DROP TABLE #PublisherInfo
IF OBJECT_ID ('TEMPDB..##SubscriptionInfo') IS NOT NULL
DROP TABLE ##SubscriptionInfo
SELECT * INTO #PublisherInfo
FROM OPENROWSET('SQLOLEDB', 'SERVER=(LOCAL);TRUSTED_CONNECTION=YES;'
, 'SET FMTONLY OFF EXEC distribution.dbo.sp_replmonitorhelppublisher')
SELECT @publisher = publisher FROM #PublisherInfo
SET @cmd = 'SELECT * INTO ##PublicationInfo FROM OPENROWSET(''SQLOLEDB'',''SERVER=(LOCAL);TRUSTED_CONNECTION=YES''
,''SET FMTONLY OFF EXEC distribution.dbo.sp_replmonitorhelppublication @publisher='
+ @publisher + ''')'
--select @cmd
EXEC sp_executesql @cmd
SELECT @publisher_db=publisher_db, @publication=publication, @pubtype=publication_type FROM ##PublicationInfo
SET @cmd = 'SELECT * INTO ##SubscriptionInfo FROM OPENROWSET(''SQLOLEDB'',''SERVER=(LOCAL);TRUSTED_CONNECTION=YES''
,''SET FMTONLY OFF EXEC distribution.dbo.sp_replmonitorhelpsubscription @publisher='
+ @publisher + ',@publication_type=' + CONVERT(CHAR(1),@pubtype) + ''')'
--select @cmd
EXEC sp_executesql @cmd
ALTER TABLE ##SubscriptionInfo
ADD PendingCmdCount INT NULL,
EstimatedProcessTime INT NULL
SELECT *
FROM #PublisherInfo
SELECT *
FROM ##SubscriptionInfo
SELECT *
FROM ##PublicationInfo
아래 마지막 상자에 두 줄이 표시됩니다. 한 줄은 없어야합니다.
이 스크립트를 사용할 때도 마찬가지입니다.
EXEC distribution.dbo.sp_replmonitorhelppublication @publisher='my publisher'
첫째로 당신은 다른 같다 무엇 답변 , 위의 그 작품을하면 괜찮습니다, 가끔 작동 문제가 해결.
그것은 더 적을 것입니다 :
exec master.dbo.sp_replicationdboption @dbname = 'my_PUBLICATION', @optname = N'publish', @value = N'false'
exec master.dbo.sp_replicationdboption @dbname = 'my_PUBLICATION', @optname = N'publish', @value = N'true'
sp_droppublication @publication='my_PUBLICATION'
-- Remove replication objects from a subscription database (if necessary).
exec master.dbo.sp_removedbreplication 'my_PUBLICATION'
exec master.dbo.sp_removedbreplication 'my_PUBLICATION'
use my_PUBLICATION
sp_removedbreplication @type='both'
USE [master]
EXEC sp_replicationdboption
@dbname = N'my_PUBLICATION',
@optname = N'publish',
@value = N'false';
GO
EXEC distribution.dbo.sp_replmonitorhelppublication @publisher='PUBLISHER_SERVER'
sp_replmonitorhelppublisher @publisher='PUBLISHER_SERVER'
DECLARE @publicationDB AS sysname;
DECLARE @publication AS sysname;
SET @publicationDB = N'my_PUBLICATION';
SET @publication = N'my_PUBLICATION';
-- Remove a transactional publication.
USE my_PUBLICATION
EXEC sp_droppublication @publication = @publication;
-- Remove replication objects from the database.
USE [master]
EXEC sp_replicationdboption
@dbname = @publicationDB,
@optname = N'publish',
@value = N'false';
GO
이제이 발행물을 완전히 없애기 위해 아래 스크립트에 따라 buscriber, 게시자 및 배포자에 연결하여 시작합니다.
-- Connect Subscriber
:connect [SUBSCRIBER_SERVER]
use [master]
exec sp_helpreplicationdboption @dbname = N'SUBSCRIBER_DATABASE'
go
use [SUBSCRIBER_DATABASE]
exec sp_subscription_cleanup @publisher = N'PUBLISHER_SERVER', @publisher_db = N'my_PUBLICATION_DB',
@publication = N'my_PUBLICATION'
go
-- Connect Publisher Server
:connect [PUBLISHER_SERVER]
-- Drop Subscription
use [my_PUBLICATION]
exec sp_dropsubscription @publication = N'my_PUBLICATION', @subscriber = N'all',
@destination_db = N'SUBSCRIBER_DATABASE', @article = N'all'
go
-- Drop publication
exec sp_droppublication @publication = N'my_PUBLICATION'
-- Disable replication db option
exec sp_replicationdboption @dbname = N'my_PUBLICATION_db', @optname = N'publish', @value = N'false'
GO
-- Connect Distributor
:CONNECT [PUBLISHER_SERVER]
go
exec Distribution.dbo.sp_MSremove_published_jobs @server = 'PUBLISHER_SERVER',
@database = N'my_PUBLICATION'
go
--===========================================================================================
--THAT DOES NOT GENERALLY GET RID OF THE JOBS FOR YOU
-- so you need to find them using these selects, and get rid of them manually yourself:
--select * from Distribution.dbo.MSpublications
--select * from Distribution.dbo.MSpublications
--===========================================================================================
select * from Distribution.[dbo].[MSlogreader_agents]
where publisher_db = N'my_PUBLICATION'
--found 1 job:
--PUBLISHER_SERVER-my_PUBLICATION-11
--script the job
--script the job delete script - and run that - keeping the job creation script just in case
exec msdb.dbo.sp_help_job @job_id=0x93C63D34E357704B818312B93FCA02FB
exec msdb.dbo.sp_delete_job @job_id=0x93C63D34E357704B818312B93FCA02FB
select * from Distribution.[dbo].[MSdistribution_agents]
where publisher_db = N'my_PUBLICATION'
--here found 2 jobs:
--PUBLISHER_SERVER-my_PUBLICATION-my_PUBLICATION--67
--PUBLISHER_SERVER-my_PUBLICATION-my_PUBLICATION--68
--here is the problem - it cannot find the jobs, the jobs are not even there anymore, one of those things
exec msdb.dbo.sp_delete_job @job_id=0x0F1564BAACD5464C988DE8957C25C411
exec msdb.dbo.sp_delete_job @job_id=0x6215C40F999CE248A30EE735E2C0E59D
--Msg 14262, Level 16, State 1, Procedure sp_verify_job_identifiers, Line 41 [Batch Start Line 52]
--The specified @job_id ('BA64150F-D5AC-4C46-988D-E8957C25C411') does not exist.
--Msg 14262, Level 16, State 1, Procedure sp_verify_job_identifiers, Line 41 [Batch Start Line 53]
--The specified @job_id ('0FC41562-9C99-48E2-A30E-E735E2C0E59D') does not exist.
exec msdb.dbo.sp_delete_job @job_name='PUBLISHER_SERVER-my_PUBLICATION-my_PUBLICATION'
PUBLISHER_SERVER-my_PUBLICATION-my_PUBLICATION--68
이 시점에서 일반적으로하는 것처럼 발행물을 다시 작성하십시오.
그런 다음 스냅 샷을 실행합니다
스냅 샷 생성이 완료 될 때까지 기다리십시오.
MAYBE YOU DONT NEED TO RUN THE SNAP
- without
대부분 먼저 작동하고 먼저 small
발행물에 1-2 개의 기사를 추가 하여 스냅을 빠르게 실행할 수 있습니다.
그러나 스냅 샷을 실행하면 다음 단계로 넘어 가기 전에 완료 될 때까지 기다려야합니다. drop the publication
그 후 drop that publication
아래 그림에 따라 스크립트를 생성하십시오 .
그런 다음 위의 원래 스크립트 를 실행 하거나 복제 모니터를 볼 때 결함이있는 발행물은 볼 수 없으며, 좋은 경우에는 제게 하나만 표시됩니다.