Configure the media retention Server Configuration Option
This topic describes how to configure the media retention server configuration option in SQL Server 2014 by using SQL Server Management Studio or Transact-SQL. The media retention option specifies the length of time to retain each backup set. The option helps protect backups from being overwritten until the specified number of days has elapsed. After you configure media retention option, you do not have to specify the length of time to retain system backups each time you perform a backup. The default value is 0 days, and the maximum value is 365 days.
In This Topic
Before you begin:
To configure the media retention option, using:
- If you use the backup medium before the set number of days has passed, SQL Server issues a warning message. SQL Server does not issue a warning unless you change the default.
This option is an advanced option and should be changed only by an experienced database administrator or certified SQL Server technician.
The media retention option can be overridden by using the RETAINDAYS clause of the BACKUP statement.
Execute permissions on sp_configure with no parameters or with only the first parameter are granted to all users by default. To execute sp_configure with both parameters to change a configuration option or to run the RECONFIGURE statement, a user must be granted the ALTER SETTINGS server-level permission. The ALTER SETTINGS permission is implicitly held by the sysadmin and serveradmin fixed server roles.
In Object Explorer, right-click a server and select Properties.
Click the Database settings node.
Under Backup/Restore, in the Default backup media retention box, type or select a value from 0 through 365 to set the number of days the backup medium will be retained after a database or transaction log backup.
Connect to the Database Engine.
From the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute. This example shows how to use sp_configure to set the value of the
media retentionoption to
USE AdventureWorks2012 ; GO EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE ; GO EXEC sp_configure 'media retention', 60 ; GO RECONFIGURE; GO
For more information, see Server Configuration Options (SQL Server).
The setting takes effect immediately without restarting the server.