症狀
假設您使用的是 Microsoft SQL Server 2012 或 SQL Server 2014。 當您在 RBS) Maintainer (執行遠端 BLOB 儲存體時,RBS Maintainer 工具失敗,並且收到下列錯誤訊息:
注意
啟動維護者工作。
啟動廢棄項目收集。
開始參照掃描。
此資料庫的參照掃描已完成。
已掃描 113 個 blob。 已刪除 0x000000000000000000000000 (個排除) 範圍內的 0 個 blob,以 0x00000000000000b600000002 (包容性) 。
此工作已結束。 共處理 1 個工作單位。 0 工作單元未完成。
開始刪除傳播。
目前沒有可用的工作。
其他用戶端、處理序或執行緒目前可能正在處理其他工作。
因為發生錯誤而略過目前的工作單元。 如需詳細資訊,請參閱 RBS 維護者記錄。
[..]
此工作已結束。 總共處理了 102 個工作單位。 101 個工作單位未完成。 需要刪除 0 個 blob。 已成功刪除 0 個 blob,在 blob 存放區中找不到 0 個 blob。
此工作已結束。
此工作已結束。
當您使用 Profiler 來追蹤問題時,收到下列錯誤訊息:
注意
Msg 50000, Level 16, State 0, Procedure rbs_sp_rethrow_error, line 38
RBS 錯誤。 原始錯誤:編號 535,嚴重性 16,狀態 0,程序 rbs_sp_count,第 52 行,
訊息:datediff 函數導致溢位。 分隔兩個日期/時間執行個體的 dateparts 數目太大。 請嘗試將 datediff 與不太精確的日期部分一起使用。
原因
之所以發生此問題,是因為檢查上次執行以來時間的查詢在將值轉換為毫秒時可能會溢位。 這將導致查詢失敗,並且工作在未處理資料的情況下結束。
解決方式
此問題的修正程式可在 RBS.msi 的最新功能套件下載中取得。 如果您已有 RBS 的現有安裝,建議您執行「因應措施」一節中提供的指令碼來暫時修正此問題。
下載 Microsoft SQL Server 2014 Service Pack 2 (SP2) Feature Pack
下載 Microsoft SQL Server 2012 Service Pack 4 (SP4) Feature Pack
因應措施
如果您在 SQL Server 2012 或 SQL Server 2014 上有尚未安裝修正程式的 RBS 安裝,您可以使用下列因應措施步驟:
在 SSMS 中,開啟步驟 3 的指令碼,然後連線到裝載您要套用修正程式之 RBS 用戶端資料庫的 SQL Server 執行個體。
在指令碼中,將 “your_RBS_client_database” 字串取代為 RBS 用戶端資料庫的實際名稱。
執行指令碼以套用修正。
使用 [your_RBS_client_database]
返如果object_id (N'mssqlrbs_resources.rbs_sp_count') 不是 Null
卸除程序 mssqlrbs_resources.rbs_sp_count
返建立程序 mssqlrbs_resources.rbs_sp_count (
@operation smallint,
@object smallint = 0,
@value bigint = null,
@start_time datetime = null,
@end_time datetime = null,
@description sysname = N'',
@message nvarchar (max) = null
)
作為
開始宣告 @type tinyint,
@secondsUsed 位元,
@seconds浮動宣告 @maxDays int = 10;
如果不存在 (
select * from mssqlrbs_resources.rbs_internal_counters
其中 operation = @operation and object = @object and description = @description
)
raiserror (RBS 中的 N'Internal 錯誤。 嘗試計算無效的效能計數器。 計數器: <%d>。<%d>。<%s>.',
16, 101, @operation, , @object@description)選取
@type = 類型,
@secondsUsed = seconds_used
寄件者
mssqlrbs_resources.rbs_internal_counters
其中
operation = @operation 和
object = @object 和
描述 = @descriptionif @object != 0
開始
如果 @value 為 null
raiserror (RBS 中的 N'Internal 錯誤。 未為效能計數器 <%d> 指定值。<%d>。<%s>.',
16, 103, @operation, , @object@description)
end如果 @secondsUsed = 1
開始
如果 (@start_time 為 null)
raiserror (RBS 中的 N'Internal 錯誤。 未針對效能計數器 <%d> 指定開始時間。<%d>。<%s>.',
16, 102, @operation, @object, @description)Set @end\_time = IsNull (@end_time, GetUtcDate () )
如果 (@start_time >@end\_time)
raiserror (RBS 中的 N'Internal 錯誤。 開始時間在結束時間之後。 計數器: <%d>。<%d>。<%s>.',
16, 104, @operation, , @object@description)如果 (日期 (day, @start\_time, @end\_time)>= @maxDays)
開始
set @seconds = convert (float, datediff (second, @start\_time, @end\_time))
end
否則
開始
set @seconds = convert (float, datediff (millisecond, @start\_time, @end\_time)) / 1000
end
end更新 mssqlrbs_resources.rbs_internal_counters
設定
count = count + 1,
value = value + @value,
squared_value = squared_value + 正方形 (@value) ,
min_value = 大小寫
當 min_value 為 null 時 @value
當 (@value < min_value) @value
否則min_value
end,
max_value = 大小寫
當 max_value 為 null 時 @value
當 (@value > max_value) 然後 @value
否則max_value
end,
last_value = @value,
秒 = 秒 + @seconds,
squared_seconds = squared_seconds + 平方 (@seconds) ,
min_seconds = 大小寫
當 min_seconds 為 null 時 @seconds
當 (@seconds < min_seconds) 則 @seconds
否則min_seconds
end,
max_seconds = 大小寫
當 max_seconds 為 null 時 @seconds
當 (@seconds > max_seconds) 則 @seconds
否則max_seconds
end,
last_seconds = @seconds,
last_update_time = getutcdate () ,
last_message = @message
其中
operation = @operation 和
object = @object 和
描述 = @descriptionend
返
狀態
Microsoft 已確認這是「適用對象」一節中列出的 Microsoft 產品中的問題。