Enable or disable backup checksums during backup or restore (SQL Server)
Applies to: SQL Server
This article describes how to enable or disable backup checksums when you're backing up or restoring a database in SQL Server by using SQL Server Management Studio or Transact-SQL.
Permissions
BACKUP
BACKUP DATABASE
and BACKUP LOG
permissions default to members of the sysadmin fixed server role and the db_owner and db_backupoperator fixed database roles.
Ownership and permission problems on the backup device's physical file can interfere with a backup operation. SQL Server must be able to read and write to the device; the account under which the SQL Server service runs must have write permissions. However, sp_addumpdevice, which adds an entry for a backup device in the system tables, doesn't check file access permissions. Such problems on the backup device's physical file might not appear until the physical resource is accessed when the backup or restore is attempted.
RESTORE
If the database being restored doesn't exist, the user must have CREATE DATABASE
permissions to be able to execute RESTORE
. If the database exists, RESTORE
permissions default to members of the sysadmin and dbcreator fixed server roles and the owner (dbo) of the database (for the FROM DATABASE_SNAPSHOT
option, the database always exists).
RESTORE
permissions are given to roles in which membership information is always readily available to the server. Because fixed database role membership can be checked only when the database is accessible and undamaged, which isn't always the case when RESTORE
is executed, members of the db_owner fixed database role don't have RESTORE
permissions.
Use SQL Server Management Studio
Enable or disable checksums during a backup operation
Follow the steps to create a database backup.
On the Options page, in the Reliability section, select Perform checksum before writing to media.
Use Transact-SQL
Enable or disable backup checksum for a backup operation
Connect to the Database Engine.
From the Standard bar, select New Query.
To enable backup checksums in a BACKUP (Transact-SQL) statement, specify the
WITH CHECKSUM
option. To disable backup checksums, specify theWITH NO_CHECKSUM
option. This is the default behavior, except for a compressed backup. The following example specifies that checksums be performed.
BACKUP DATABASE AdventureWorks2022
TO DISK = 'Z:\SQLServerBackups\AdvWorksData.bak'
WITH CHECKSUM;
GO
Enable or disable backup checksum for a restore operation
Connect to the Database Engine.
From the Standard bar, select New Query.
To enable backup checksums in a RESTORE Statements (Transact-SQL) statement, specify the
WITH CHECKSUM
option. This is the default behavior for a compressed backup. To disable backup checksums, specify theWITH NO_CHECKSUM
option. This is the default behavior, except for a compressed backup. The following example specifies that backup checksums be performed.
RESTORE DATABASE AdventureWorks2022
FROM DISK = 'Z:\SQLServerBackups\AdvWorksData.bak'
WITH CHECKSUM;
GO
Warning
If you explicitly request CHECKSUM
for a restore operation and if the backup contains backup checksums, backup checksums and page checksums are both verified, as in the default case. However, if the backup set lacks backup checksums, the restore operation fails with a message indicating that checksums aren't present.
Related content
- RESTORE Statements - FILELISTONLY (Transact-SQL)
- RESTORE statements - HEADERONLY (Transact-SQL)
- RESTORE Statements - LABELONLY (Transact-SQL)
- RESTORE Statements - VERIFYONLY (Transact-SQL)
- BACKUP (Transact-SQL)
- backupset (Transact-SQL)
- RESTORE Statements - Arguments (Transact-SQL)
- Possible Media Errors During Backup and Restore (SQL Server)
- Specify backup or restore to continue or stop after error