現象
Microsoft SQL Server 2012 または SQL Server 2014 を使用しているとします。 リモート BLOB ストレージ (RBS) Maintainer を実行すると、RBS Maintainer ツールが失敗し、次のエラー メッセージが表示されます。
注
メンテナタスクを開始します。
ガベージ コレクションを開始します。
参照スキャンを開始します。
このデータベースの参照スキャンが完了しました。
113 個の BLOB をスキャンしました。 0x000000000000000000000000(含まない) から 0x00000000000000b600000002(両端を含む) の範囲で 0 個の BLOB を削除しました。
このタスクは終了しました。 合計 1 作業単位を処理しました。 0 作業単位が不完全でした。
削除の伝播を開始します。
現在、作業はありません。
他のクライアント、プロセス、またはスレッドが現在、他のタスクで作業している可能性があります。
エラーが発生したため、現在の作業単位をスキップしています。 詳細については、RBS メンテナーのログを参照してください。
[..]
このタスクは終了しました。 合計 102 の作業単位を処理しました。 101 作業単位が不完全でした。 0 個の BLOB を削除する必要があります。 0 個の BLOB の削除に成功しました。0 個の BLOB が BLOB ストアで見つかりませんでした。
このタスクは終了しました。
このタスクは終了しました。
プロファイラーを使用して問題をトレースすると、次のエラー メッセージが表示されます。
注
メッセージ 50000、レベル 16、状態 0、プロシージャ rbs_sp_rethrow_error、行 38
RBS エラー。 元のエラー: 番号 535、重大度 16、状態 0、プロシージャ rbs_sp_count、行 52、
メッセージ: datediff 関数によりオーバーフローが発生しました。 2 つの日付/時刻インスタンスを区切る日付パーツの数が多すぎます。 datediff の精度の低い datepart を使用するようにしてください。
原因
この問題は、前回の実行以降の時間をチェックするクエリが値をミリ秒に変換するときにオーバーフローする可能性があるために発生します。 これによりクエリが失敗し、タスクがデータを処理せずに終了します。
解決策
この問題の修正プログラムは、RBS.msi 用の最新の Feature Pack ダウンロードで入手できます。 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 クライアント データベースの実際の名前に置き換えます。
スクリプトを実行して修正を適用します。
use [your_RBS_client_database]
行くobject_id(N'mssqlrbs_resources.rbs_sp_count') が 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
)
方法
beginDeclare @type tinyint,
@secondsUsedビット、
@seconds floatdeclare @maxDays int = 10;
存在しない場合 (
select * from mssqlrbs_resources.rbs_internal_counters
where operation = @operation and object = @object and description = @description
)
raiserror (N'RBS の内部エラー。 無効なパフォーマンス カウンターのカウントを試行します。 カウンター: <%d>.<%d>.<%s>.',
16、101、 @operation、 @object、 @description)選択
@type = type,
@secondsUsed = seconds_used
コード体系
mssqlrbs_resources.rbs_internal_counters
ここで、
operation = @operation と
object = @object and
description = @descriptionif @object != 0
begin
@value が null の場合
raiserror (N'RBS の内部エラー。 パフォーマンス カウンター <%d>.< に値が指定されていません%d>.<%s>.',
16、103、 @operation、 @object、 @description)
endif @secondsUsed = 1
begin
if (@start_time is null)
raiserror (N'RBS の内部エラー。 パフォーマンス カウンター <%d>.< に開始時刻が指定されていません%d>.<%s>.',
16、102、 @operation、 @object、 @description)set @end\_time = isnull(@end_time, getutcdate())
if (@start_time >@end\_time)
raiserror (N'RBS の内部エラー。 開始時刻が終了時刻より後になります。 カウンター: <%d>.<%d>.<%s>.',
16, 104, @operation, @object, @description)if (datediff(day, @start\_time, @end\_time)>= @maxDays)
begin
set @seconds = convert(float, datediff(second, @start\_time, @end\_time))
end
else
begin
set @seconds = convert(float, datediff(millisecond, @start\_time, @end\_time)) / 1000
end
endupdate mssqlrbs_resources.rbs_internal_counters
設定
count = count + 1,
value = value + @value,
squared_value = squared_value + square(@value),
min_value = 大文字と小文字
min_value が null の場合 @value
when (@value < min_value) then @value
else min_value
end,
max_value = 大文字と小文字
max_value が null の場合 @value
when (@value > max_value) then @value
else max_value
end,
last_value = @value,
seconds = seconds + @seconds,
squared_seconds = squared_seconds + square(@seconds),
min_seconds = case
min_seconds が null の場合 @seconds
when (@seconds < min_seconds) then @seconds
else min_seconds
end,
max_seconds = 大文字と小文字
max_seconds が null の場合 @seconds
when (@seconds > max_seconds) then @seconds
else max_seconds
end,
last_seconds = @seconds,
last_update_time = getutcdate(),
last_message = @message
ここで、
operation = @operation と
object = @object and
description = @descriptionend
行く
状態
Microsoft は、これが "適用対象" セクションに記載されている Microsoft 製品の問題であることを確認しました。