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,當還原作業執行時,輔助伺服器會還原所有可用的事務歷史記錄備份。 否則,它會在還原一個檔案之後停止。 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的預設值為 -1 的 int。
[ @buffer_count = ] 'buffer_count'
備份或還原作業所使用的緩衝區總數。 buffer_count為 -1 的預設值為 int。
[ @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為 bit 且不能為 NULL。
[ @history_retention_period = ] 'history_retention_period'
這是記錄將保留的分鐘數時間長度。 history_retention_period為 int。如果未指定任何值,則會使用 1440 的值。
傳回碼值
0 (成功) 或 1 (失敗)
結果集
None
備註
sp_change_log_shipping_secondary_database必須從輔助伺服器上的 master 資料庫執行。 此預存程式會執行下列動作:
視需要變更log_shipping_secondary_database記錄中的設定。
視需要,使用提供的自變數,在輔助伺服器上變更log_shipping_monitor_secondary的本機監視器記錄。
權限
只有系統管理員固定伺服器角色的成員才能執行此程式。
範例
此範例說明如何使用 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 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應