Događaji
M03 31 23 - M04 2 23
Najveći događaj učenja jezika SQL, platforme Fabric i platforme Power BI. 31. mart - 2. april Koristite kod FABINSIDER da uštedite 400 dolara.
Registrirajte se danasOvaj preglednik više nije podržan.
Nadogradite na Microsoft Edge da iskoristite najnovije osobine, sigurnosna ažuriranja i tehničku podršku.
Applies to:
SQL Server
Changes the primary database settings.
Transact-SQL syntax conventions
sp_change_log_shipping_primary_database
[ @database = ] 'database'
[ , [ @backup_directory = ] N'backup_directory' ]
[ , [ @backup_share = ] N'backup_share' ]
[ , [ @backup_retention_period = ] 'backup_retention_period' ]
[ , [ @monitor_server_security_mode = ] 'monitor_server_security_mode' ]
[ , [ @monitor_server_login = ] 'monitor_server_login' ]
[ , [ @monitor_server_password = ] 'monitor_server_password' ]
[ , [ @backup_threshold = ] 'backup_threshold' ]
[ , [ @threshold_alert = ] 'threshold_alert' ]
[ , [ @threshold_alert_enabled = ] 'threshold_alert_enabled' ]
[ , [ @history_retention_period = ] 'history_retention_period' ]
[ , [ @backup_compression = ] backup_compression_option ]
[ ; ]
The name of the database on the primary server. @primary_database is sysname, with no default.
The path to the backup folder on the primary server. @backup_directory is nvarchar(500), with no default, and can't be NULL
.
The network path to the backup directory on the primary server. @backup_share is nvarchar(500), with no default, and can't be NULL
.
The length of time, in minutes, to retain the log backup file in the backup directory on the primary server. @backup_retention_period is int, with no default, and can't be NULL
.
The security mode used to connect to the monitor server.
1
= Windows Authentication0
= SQL Server Authentication@monitor_server_security_mode is bit and defaults to NULL
.
The username of the account used to access the monitor server.
The password of the account used to access the monitor server.
The length of time, in minutes, after the last backup before a @threshold_alert error is raised. @backup_threshold is int, with a default of 60 minutes.
The alert to be raised when the backup threshold is exceeded. @threshold_alert is int and can't be NULL
.
Specifies whether an alert is raised when @backup_threshold is exceeded.
1
: enabled0
: disabledthreshold_alert_enabled is bit and can't be NULL
.
The length of time in minutes in which the history is retained. @history_retention_period is int. A value of 14420 is used if none is specified.
Specifies whether a log shipping configuration uses backup compression. This parameter is supported in Enterprise edition for SQL Server 2008 (10.0.x) (and later versions), and all editions on SQL Server 2016 (13.x) with Service Pack 1 (and later versions).
0
: Disabled. Never compress log backups
1
: Enabled. Always compress log backups
2
(default): Use the setting of the View or Configure the backup compression default (server configuration option)
0
(success) or 1
(failure).
None.
sp_change_log_shipping_primary_database
must be run from the master
database on the primary server. This stored procedure does the following:
Changes the settings in the log_shipping_primary_database
record, if necessary.
Changes the local record in log_shipping_monitor_primary
on the primary server using supplied arguments, if necessary.
If the monitor server is different from the primary server, changes record in log_shipping_monitor_primary
on the monitor server using supplied arguments, if necessary.
Only members of the sysadmin fixed server role can run this procedure.
This example illustrates the use of sp_change_log_shipping_primary_database
to update the settings associated with the primary database AdventureWorks2022
.
EXEC master.dbo.sp_change_log_shipping_primary_database
@database = N'AdventureWorks',
@backup_directory = N'c:\LogShipping',
@backup_share = N'\\tribeca\LogShipping',
@backup_retention_period = 1440,
@backup_threshold = 60,
@threshold_alert = 0,
@threshold_alert_enabled = 1,
@history_retention_period = 1440,
@monitor_server_security_mode = 1,
@backup_compression = 1;
Događaji
M03 31 23 - M04 2 23
Najveći događaj učenja jezika SQL, platforme Fabric i platforme Power BI. 31. mart - 2. april Koristite kod FABINSIDER da uštedite 400 dolara.
Registrirajte se danas