當我在複製的出版物上有延遲時,我會添加一個令牌並觀察它。 有沒有任何方法可以在不使用標記的情況下解決複製延遲問題? 這是SQL Server 2005-事務複製。有沒有辦法在不使用令牌的情況下監視事務複製延遲?
1
A
回答
0
我發現這個鏈接約checking replication latency using T-SQL 並創建了我的環境中的過程,它的工作非常好。
這裏是過程的代碼,在評論中,我是如何利用它的。
USE [MY_PUBLICATION_DATABASE]
-- this procedure is to be created inside the publication database
GO
Create Procedure dbo.dba_replicationLatencyGet_sp
/* Declare Parameters */
@publicationToTest sysname = N'yourPublicationName'
, @replicationDelay varchar(10) = N'00:00:30'
, @iterations int = 5
, @iterationDelay varchar(10) = N'00:00:30'
, @deleteTokens bit = 1
, @deleteTempTable bit = 1
As
/*********************************************************************************
Name: dba_replicationLatencyGet_sp
Author: Michelle F. Ufford
Purpose: Retrieves the amount of replication latency in seconds
Notes: Default settings will run 1 test every minute for 5 minutes.
@publicationToTest = change the default to your publication
@replicationDelay = how long to wait for the token to replicate;
probably should not set to anything less than 10 (in seconds)
@iterations = how many tokens you want to test
@iterationDelay = how long to wait between sending test tokens
(in seconds)
@deleteTokens = whether you want to retain tokens when done
@deleteTempTable = whether or not to retain the temporary table
when done. Data stored to ##tokenResults; set @deleteTempTable
flag to 0 if you do not want to delete when done.
Called by: DBA
----------------------------------------------------------------------------
Marcelo Miorelli
01-Oct-2014 wednesday
I found this wonderful procedure at this site:
http://sqlfool.com/2008/11/checking-replication-latency-with-t-sql/
I have tested it
Server: SQLWEBLON1.DEV.BODEN.LOCAL
DB: AUAccount
I had to create the procedure in the Publisher database, and run it from there.
Exec dbo.dba_replicationLatencyGet_sp
@publicationToTest = N'AUAccount'
, @replicationDelay = N'00:00:05'
, @iterations = 1
, @iterationDelay = N'00:00:05'
, @deleteTokens = 1
, @deleteTempTable = 1;
"La observación y la percepción son dos cosas separadas;
el ojo que observa es más fuerte, el ojo que percibe es más débil. "
"el libro de los 5 anillos"
Mushashi
----------------------------------------------------------------------------
Date Initials Description
----------------------------------------------------------------------------
2008-11-20 MFU Initial Release
*********************************************************************************
Exec dbo.dba_replicationLatencyGet_sp
@publicationToTest = N'yourPublicationName'
, @replicationDelay = N'00:00:05'
, @iterations = 1
, @iterationDelay = N'00:00:05'
, @deleteTokens = 1
, @deleteTempTable = 1;
*********************************************************************************/
Set NoCount On;
Set XACT_Abort On;
Begin
/* Declare Variables */
Declare @currentIteration int
, @tokenID bigint
, @currentDateTime smalldatetime;
If Object_ID('tempdb.dbo.##tokenResults') Is Null
Begin
Create Table ##tokenResults
(iteration int Null
, tracer_id int Null
, distributor_latency int Null
, subscriber varchar(1000) Null
, subscriber_db varchar(1000) Null
, subscriber_latency int Null
, overall_latency int Null);
End;
/* Initialize our variables */
Select @currentIteration = 0
, @currentDateTime = GetDate();
While @currentIteration < @iterations
Begin
/* Insert a new tracer token in the publication database */
Execute sys.sp_postTracerToken
@publication = @publicationToTest,
@tracer_token_id = @tokenID OutPut;
/* Give a few seconds to allow the record to reach the subscriber */
WaitFor Delay @replicationDelay;
/* Store our results in a temp table for retrieval later */
Insert Into ##tokenResults
(
distributor_latency
, subscriber
, subscriber_db
, subscriber_latency
, overall_latency
)
Execute sys.sp_helpTracerTokenHistory @publicationToTest, @tokenID;
/* Assign the iteration and token id to the results for easier investigation */
Update ##tokenResults
Set iteration = @currentIteration + 1
, tracer_id = @tokenID
Where iteration Is Null;
/* Wait for the specified time period before creating another token */
WaitFor Delay @iterationDelay;
/* Avoid endless looping... :) */
Set @currentIteration = @currentIteration + 1;
End;
Select * From ##tokenResults;
If @deleteTempTable = 1
Begin
Drop Table ##tokenResults;
End;
If @deleteTokens = 1
Begin
Execute sp_deleteTracerTokenHistory @publication = @publicationToTest, @cutoff_date = @currentDateTime;
End;
Set NoCount Off;
Return 0;
End
Go
1
您可以通過使用和複製日期時間列並使用發佈服務器上每X分鐘的當前時間戳更新它來推出自己的解決方案。然後,在訂閱服務器上,您可以每X分鐘運行一次作業,並將日期時間列值與當前時間進行比較,並在差異大於X分鐘時發出警報。
+0
+1因爲它非常合乎邏輯 – 2014-10-01 15:54:44
相關問題
- 1. 有沒有辦法監控C++/MacOS中的堆使用情況?
- 2. 有沒有辦法在沒有事件的情況下啓動轉換
- 3. 如何在沒有凍結的情況下延遲 - Inno Setup
- 4. 在沒有濫用[UIView animateWithDuration]的情況下觸發延遲後的方法?
- 5. 有沒有辦法在沒有使用WMI的情況下管理Microsoft DNS?
- 6. 有沒有辦法在不使用TimePickerDialog的情況下獲取TimePicker的時間?
- 7. 有沒有辦法在不使用自動縮放選項的情況下複製我們的AWS EC2實例?
- 8. 有沒有辦法在不使用選擇器的情況下響應UIButton tap?
- 9. 有沒有辦法在不使用svnadmin轉儲的情況下遷移svn?
- 10. 有沒有辦法在不編譯的情況下使用scipy.interpolate rbf函數?
- 11. 有沒有辦法在不安裝包的情況下使用PostSharp
- 12. 有沒有什麼辦法可以在不使用jQuery的情況下在Angular WYSIWYG指令中使用colorPicker
- 13. NSTimer:如何在沒有延遲的情況下更改預定的方法?
- 14. 在沒有明確複製的情況下使用Einsum
- 15. Django:在沒有CSRF令牌的情況下重置密碼
- 16. 在沒有瀏覽器的情況下獲取訪問令牌
- 17. 有沒有辦法在Silverlight中沒有Webclient的情況下下載文件?
- 18. 有沒有辦法在設置size參數的情況下使buffer()可寫而不需要複製?
- 19. 有沒有辦法在不安裝的情況下引用ghostscript的DLL?
- 20. 有沒有辦法在不調用__init__的情況下實例化一個類?
- 21. 有沒有辦法在不傳遞參數的情況下調用函數?
- 22. 有沒有辦法在不發送推送通知的情況下調用saveCurrentTurnWithMatchData?
- 23. 在有或沒有索引的情況下複製數據庫?
- 24. 有沒有辦法在不使用全局變量的情況下突破jQuery中的事件遞歸?
- 25. 在沒有使用Facebook SDK的情況下獲取Facebook授權令牌
- 26. 是否可以在沒有認證令牌的情況下使用AWS API
- 27. 有沒有辦法在不使用(MFC)動態對象創建的情況下在CSplitterWnd中創建視圖?
- 28. 在沒有宏的情況下使用延遲/強制來實現控制結構?
- 29. 在沒有明確使用KRL的情況下舉辦活動
- 30. 有沒有辦法在不使用桌面版本或命令行的情況下將文件導入Github?
爲什麼不張貼標誌上sp_post_tracertoken定期?然後,您可以查看複製監視器中所有令牌的進度,並知道哪一個最後一次傳送,需要多長時間才能到達,等等。 – 2014-09-29 01:16:36