sp_change_log_shipping_secondary_database (Transact-SQL)
適用対象:SQL Server
セカンダリ データベースの設定を変更します。
構文
sp_change_log_shipping_secondary_database
[ @secondary_database = ] 'secondary_database',
[, [ @restore_delay = ] 'restore_delay']
[, [ @restore_all = ] 'restore_all']
[, [ @restore_mode = ] 'restore_mode']
[, [ @disconnect_users = ] 'disconnect_users']
[, [ @block_size = ] 'block_size']
[, [ @buffer_count = ] 'buffer_count']
[, [ @max_transfer_size = ] 'max_transfer_size']
[, [ @restore_threshold = ] 'restore_threshold']
[, [ @threshold_alert = ] 'threshold_alert']
[, [ @threshold_alert_enabled = ] 'threshold_alert_enabled']
[, [ @history_retention_period = ] 'history_retention_period']
引数
[ @restore_delay = ] 'restore_delay'
セカンダリ サーバーが特定のバックアップ ファイルを復元するまでに待機する時間 (分)。 restore_delayは int であり、NULL にすることはできません。 既定値は0です。
[ @restore_all = ] 'restore_all'
1 に設定すると、セカンダリ サーバーは、復元ジョブの実行時に使用可能なすべてのトランザクション ログ バックアップを復元します。 それ以外の場合は、1 つのファイルが復元された後に停止します。 restore_allはビットであり、NULL にすることはできません。
[ @restore_mode = ] 'restore_mode'
セカンダリ データベースの復元モード。
0 = NORECOVERY でログを復元。
1 = STANDBY を使用してログを復元します。
restore は ビット であり、NULL にすることはできません。
[ @disconnect_users = ] 'disconnect_users'
1 に設定すると、ユーザーは復元操作の実行時にセカンダリ データベースから切断されます。 既定値 = 0。 disconnect_usersはビットであり、NULL にすることはできません。
[ @block_size = ] 'block_size'
バックアップ デバイスのブロック サイズとして使用されるサイズ (バイト単位)。 block_sizeは int で、既定値は -1 です。
[ @buffer_count = ] 'buffer_count'
バックアップ操作または復元操作で使用されるバッファーの合計数。 buffer_countは int で、既定値は -1 です。
[ @max_transfer_size = ] 'max_transfer_size'
バックアップ デバイスに対して SQL Server によって発行される最大入力または出力要求のサイズ (バイト単位)。 max_transfersizeは int であり、NULL にすることができます。
[ @restore_threshold = ] 'restore_threshold'
アラートが生成されるまでの復元操作の間に許容される時間 (分)。 restore_thresholdは int であり、NULL にすることはできません。
[ @threshold_alert = ] 'threshold_alert'
復元のしきい値を超えたときに発生するアラートです。 threshold_alertは int で、既定値は 14421 です。
[ @threshold_alert_enabled = ] 'threshold_alert_enabled'
restore_thresholdを超えたときにアラートを発生するかどうかを指定します。 1 = 有効。0 = 無効。 threshold_alert_enabledはビットであり、NULL にすることはできません。
[ @history_retention_period = ] 'history_retention_period'
履歴が保持される時間 (分単位) です。 history_retention_periodは int です。何も指定されていない場合は、値 1440 が使用されます。
リターン コードの値
0 (成功) または 1 (失敗)
結果セット
なし
解説
sp_change_log_shipping_secondary_databaseは、セカンダリ サーバー上のマスター データベースから実行する必要があります。 このストアド プロシージャでは次の処理が行われます。
必要に応じて、log_shipping_secondary_database レコードの設定を変更します。
必要に応じて、指定された引数を 使用してセカンダリ サーバー上のlog_shipping_monitor_secondary のローカル モニター レコードを変更します。
アクセス許可
このプロシージャを実行できるのは、 sysadmin 固定サーバー ロールのメンバーだけです。
例
この例では、sp_change_log_shipping_secondary_databaseを使用して、データベース LogShipAdventureWorks のセカンダリ データベース パラメーターを更新する方法を示します。
EXEC master.dbo.sp_change_log_shipping_secondary_database
@secondary_database = 'LogShipAdventureWorks'
, @restore_delay = 0
, @restore_all = 1
, @restore_mode = 0
, @disconnect_users = 0
, @threshold_alert = 14420
, @threshold_alert_enabled = 1
, @history_retention_period = 14420;
参照
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示