症状
假设你使用的是 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 跟踪问题时,您会收到以下错误消息:
注意
消息 50000,级别 16,状态 0,过程 rbs_sp_rethrow_error,行 38
RBS 错误。 原始错误:编号 535,严重性 16,状态 0,过程 rbs_sp_count,行 52,
消息: datediff 函数导致溢出。 分隔两个日期/时间实例的日期部分数太大。 尝试将 datediff 与不太精确的 datepart 一起使用。
原因
出现此问题的原因是,检查自上次执行以来的时间的查询在将值转换为毫秒时可能会溢出。 这会导致查询失败,并且任务结束而不处理数据。
解决方法
此问题的修复程序可在 RBS.msi 的最新功能包下载中获取。 如果已经安装了 RBS,建议运行“解决方法”部分中提供的脚本来临时修复该问题。
下载 Microsoft SQL Server 2014 Service Pack 2 (SP2) 功能包
下载 Microsoft SQL Server 2012 Service Pack 4 (SP4) 功能包
解决方法
如果 SQL Server 2012 或 SQL Server 2014 上已安装的 RBS 未安装修补程序,则可以使用以下解决方法步骤:
在 SSMS 中,打开步骤 3 中的脚本,然后连接到托管要应用修补程序的 RBS 客户端数据库的 SQL Server 实例。
在脚本中,将“your_RBS_client_database”字符串替换为 RBS 客户端数据库的实际名称。
运行脚本以应用修补程序。
use [your_RBS_client_database]
转到if object_id (N'mssqlrbs_resources.rbs_sp_count') is not null
删除过程 mssqlrbs_resources.rbs_sp_count
转到create procedure 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
)
as
开始DECLARE @type TINYINT,
@secondsUsed 位,
@seconds浮点declare @maxDays int = 10;
如果不存在 (
select * from mssqlrbs_resources.rbs_internal_counters
where operation = @operation and object = @object and description = @description
)
raiserror (RBS 中的 N'Internal 错误。 尝试计数无效的性能计数器。 计数器: <%d>。<%d>.<%s>.',
16, 101, @operation, , @object@description)选择
@type = 类型,
@secondsUsed = seconds_used
from
mssqlrbs_resources.rbs_internal_counters
其中
operation = @operation 和
object = @object 和
description = @descriptionif @object != 0
开始
if @value 为 null
raiserror (RBS 中的 N'Internal 错误。 未为性能计数器 <%d> 指定值。<%d>.<%s>.',
16, 103, @operation, , @object@description)
Endif @secondsUsed = 1
开始
如果 (@start_time 为 null)
raiserror (RBS 中的 N'Internal 错误。 没有为性能计数器 <%d> 指定开始时间。<%d>.<%s>.',
16, 102, @operation, , @object@description)set @end\_time = isnull (@end_time, getutcdate () )
if (@start_time >@end\_time)
raiserror (RBS 中的 N'Internal 错误。 开始时间晚于结束时间。 计数器: <%d>。<%d>.<%s>.',
16, 104, @operation, , @object@description)如果 (datediff (day, @start\_time, @end\_time)>= @maxDays)
开始
set @seconds = convert (float, datediff (second, @start\_time, @end\_time))
End
else
开始
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
else min_value
end,
max_value = 大小写
如果 max_value为 null,则 @value
当 (@value > max_value) 那么 @value
else max_value
end,
last_value = @value,
seconds = seconds + @seconds,
squared_seconds = squared_seconds + 正方形 (@seconds) ,
min_seconds = 大小写
当 min_seconds 为 null 时,则 @seconds
当 (@seconds < min_seconds) 那么 @seconds
else min_seconds
end,
max_seconds = 大小写
当 max_seconds 为 null 时,则 @seconds
当 (@seconds > max_seconds) 那么 @seconds
else max_seconds
end,
last_seconds = @seconds,
last_update_time = getutcdate () ,
last_message = @message
其中
operation = @operation 和
object = @object 和
description = @descriptionEnd
转到
状态
Microsoft 已确认在 "适用于" 部分中所列的 Microsoft 产品中存在问题。