sp_change_log_shipping_secondary_database (Transact-SQL)
セカンダリ データベースの設定を変更します。
構文
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 以外に設定すると、セカンダリ サーバーは 1 つのファイルが復元された後で停止します。 restore_all のデータ型は bit で、NULL 値は許可されません。[ @restore_mode = ] 'restore_mode'
セカンダリ データベースの復元モードを指定します。0 = NORECOVERY でログを復元。
1 = STANDBY でログを復元。
restore のデータ型は bit で、NULL 値は許可されません。
[ @disconnect_users = ] 'disconnect_users'
1 に設定すると、復元操作の実行時、ユーザーはセカンダリ データベースから切断されます。 既定値は 0 です。 disconnect_users のデータ型は bit で、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 で、既定値は 14420 です。[ @threshold_alert_enabled = ] 'threshold_alert_enabled'
restore_threshold を超過したときに警告を生成するかどうかを指定します。 1 = 有効、0 = 無効。 threshold_alert_enabled のデータ型は bit で、NULL 値は許可されません。[ @history_retention_period = ] 'history_retention_period'
履歴を保持する期間を分単位で指定します。 history_retention_period のデータ型は int です。 何も指定しない場合は、値 1440 が使用されます。
リターン コード値
0 (成功) または 1 (失敗)
結果セット
なし
説明
sp_change_log_shipping_secondary_database は、セカンダリ サーバーの master データベースから実行する必要があります。 このストアド プロシージャでは次の処理が行われます。
必要に応じて、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
関連項目
参照
システム ストアド プロシージャ (Transact-SQL)