You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Find out about the backup checksum default option. See how to use it to turn backup checksum on or off during SQL Server backup and restore operations.
Use the backup checksum default setting to enable or disable backup checksum during all backup and restore operations at the instance level.
17
-
18
-
To configure checking for errors for individual backup or restore operations, see [Enable or Disable Backup Checksums During Backup or Restore (SQL Server)](../../relational-databases/backup-restore/enable-or-disable-backup-checksums-during-backup-or-restore-sql-server.md).
19
-
20
-
The following table describes the valid values:
21
-
22
-
| Value | Meaning |
23
-
| --- | --- |
24
-
| 0 | Disabled. This is the default setting. |
25
-
| 1 | Enabled |
26
-
27
-
The setting takes effect immediately.
28
-
29
-
## Usage scenarios
30
-
31
-
You can use the backup checksum default setting to provide error-management options (`CHECKSUM` and `NO_CHECKSUM`) when using backup applications or utilities that don't natively expose these options. You might also use this option when you use utilities such as [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] log shipping or the Backup database task from [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] maintenance plans. These utilities and the associated Transact-SQL stored procedures don't provide an option to include the `CHECKSUM` option during backup.
32
-
33
-
## More information
34
-
35
-
If the page checksum validation fails during the backup operation, [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] stops the backup operation and reports error message 3043. For more information on the error and troubleshooting steps, see the error page for [MSSQLSERVER_3043](../../relational-databases/errors-events/mssqlserver-3043-database-engine-error.md).
36
-
37
-
When you use the explicit `NO_CHECKSUM` option in the `BACKUP` command, the backup checksum default server option is overridden.
38
-
39
-
To determine whether checksum was being used during a backup to protect a backup set, use one of the following methods:
40
-
41
-
- The `HasBackupChecksums` flag in the output of the `RESTORE HEADERONLY` command. For example:
42
-
43
-
```sql
44
-
RESTORE headeronly FROM disk ='c:\temp\master.bak'
45
-
```
46
-
47
-
- The `has_backup_checksums` column in the `backupset` system table in the `msdb` database. For example:
48
-
49
-
```sql
50
-
SELECT has_backup_checksums, database_name, *
51
-
FROM msdb..backupset
52
-
```
53
-
54
-
If the backup is performed by using the `CHECKSUM` option, the restore operation automatically performs the validation and then displays error message 3183. For more information on the error and troubleshooting steps, see the error page for [MSSQLSERVER_3183](../../relational-databases/errors-events/mssqlserver-3183-database-engine-error.md).
55
-
56
-
## SQL Server 2012 and earlier versions
57
-
58
-
In [!INCLUDE [sssql11-md](../../includes/sssql11-md.md)] and earlier versions, this option doesn't exist. You need to use Trace Flag 3023 to enable the `CHECKSUM` option as a default for the `BACKUP` command. Trace Flag 3023 can be used dynamically by using a `DBCC TRACEON` statement, or it can be used as a startup parameter.
59
-
60
-
### Dynamic usage
61
-
62
-
```sql
63
-
DBCC TRACEON(3023,-1);
64
-
BACKUP DATABASE...;
65
-
DBCC TRACEOFF(3023,-1);
66
-
```
67
-
68
-
### Startup parameter usage
69
-
70
-
Add the trace flag as a startup parameter to [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] (`-T3023`), and then stop and restart the [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] service.
71
-
72
-
## See also
73
-
74
-
-[Enable or Disable Backup Checksums During Backup or Restore (SQL Server)](../../relational-databases/backup-restore/enable-or-disable-backup-checksums-during-backup-or-restore-sql-server.md)
1
+
---
2
+
title: "Configure the backup checksum default (server configuration option)"
3
+
description: Find out about the backup checksum default option. See how to use it to turn backup checksum on or off during SQL Server backup and restore operations.
4
+
author: rwestMSFT
5
+
ms.author: randolphwest
6
+
ms.date: 03/28/2024
7
+
ms.service: sql
8
+
ms.subservice: configuration
9
+
ms.topic: conceptual
10
+
---
11
+
12
+
# Configure the backup checksum default (server configuration option)
Use the backup checksum default setting to enable or disable backup checksum during all backup and restore operations at the instance level.
17
+
18
+
To configure checking for errors for individual backup or restore operations, see [Enable or disable backup checksums during backup or restore (SQL Server)](../../relational-databases/backup-restore/enable-or-disable-backup-checksums-during-backup-or-restore-sql-server.md).
19
+
20
+
The following table describes the valid values:
21
+
22
+
| Value | Meaning |
23
+
| --- | --- |
24
+
|`0` (default) | Disabled |
25
+
|`1`| Enabled |
26
+
27
+
To enable backup checksum for all backup and restore operations at the instance level, run the following command:
28
+
29
+
```sql
30
+
EXEC sp_configure 'backup checksum default', 1;
31
+
RECONFIGURE;
32
+
```
33
+
34
+
The setting takes effect immediately.
35
+
36
+
## Usage scenarios
37
+
38
+
You can use the backup checksum default setting to provide error-management options (`CHECKSUM` and `NO_CHECKSUM`) when using backup applications or utilities that don't natively expose these options. You might also use this option when you use utilities such as [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] log shipping or the Backup database task from [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] maintenance plans. These utilities and the associated Transact-SQL stored procedures don't provide an option to include the `CHECKSUM` option during backup.
39
+
40
+
## More information
41
+
42
+
If the page checksum validation fails during the backup operation, [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] stops the backup operation and reports error message 3043. For more information on the error and troubleshooting steps, see the error page for [MSSQLSERVER_3043](../../relational-databases/errors-events/mssqlserver-3043-database-engine-error.md).
43
+
44
+
When you use the explicit `NO_CHECKSUM` option in the `BACKUP` command, the backup checksum default server option is overridden.
45
+
46
+
To determine whether checksum was being used during a backup to protect a backup set, use one of the following methods:
47
+
48
+
- The `HasBackupChecksums` flag in the output of the `RESTORE HEADERONLY` command. For example:
49
+
50
+
```sql
51
+
RESTORE headeronly FROM disk ='c:\temp\master.bak'
52
+
```
53
+
54
+
- The `has_backup_checksums` column in the `backupset` system table in the `msdb` database. For example:
55
+
56
+
```sql
57
+
SELECT has_backup_checksums, database_name, *
58
+
FROM msdb..backupset
59
+
```
60
+
61
+
If the backup is performed by using the `CHECKSUM` option, the restore operation automatically performs the validation, and then displays error message 3183. For more information on the error and troubleshooting steps, see the error page for [MSSQLSERVER_3183](../../relational-databases/errors-events/mssqlserver-3183-database-engine-error.md).
62
+
63
+
## SQL Server 2012 and earlier versions
64
+
65
+
In [!INCLUDE [sssql11-md](../../includes/sssql11-md.md)] and earlier versions, this option doesn't exist. You need to use Trace Flag 3023 to enable the `CHECKSUM` option as a default for the `BACKUP` command. Trace Flag 3023 can be used dynamically by using a `DBCC TRACEON` statement, or it can be used as a startup parameter.
66
+
67
+
### Dynamic usage
68
+
69
+
```sql
70
+
DBCC TRACEON(3023, -1);
71
+
BACKUP DATABASE...;
72
+
DBCC TRACEOFF(3023, -1);
73
+
```
74
+
75
+
### Startup parameter usage
76
+
77
+
Add the trace flag as a startup parameter to [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] (`-T3023`), and then stop and restart the [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)] service.
78
+
79
+
## Related content
80
+
81
+
-[Enable or disable backup checksums during backup or restore (SQL Server)](../../relational-databases/backup-restore/enable-or-disable-backup-checksums-during-backup-or-restore-sql-server.md)
Copy file name to clipboardExpand all lines: docs/relational-databases/backup-restore/enable-or-disable-backup-checksums-during-backup-or-restore-sql-server.md
+74-86Lines changed: 74 additions & 86 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,8 @@ title: "Enable or disable backup checksums during backup or restore (SQL Server)
3
3
description: This article shows you how to enable or disable backup checksums for a database in SQL Server by using SQL Server Management Studio or Transact-SQL.
4
4
author: MashaMSFT
5
5
ms.author: mathoma
6
-
ms.date: "03/17/2017"
6
+
ms.reviewer: randolphwest
7
+
ms.date: 03/28/2024
7
8
ms.service: sql
8
9
ms.subservice: backup-restore
9
10
ms.topic: conceptual
@@ -13,89 +14,76 @@ helpviewer_keywords:
13
14
- "checksums [SQL Server]"
14
15
---
15
16
# Enable or disable backup checksums during backup or restore (SQL Server)
This topic describes how to enable or disable backup checksums when you are backing up or restoring a database in [!INCLUDE[ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)].
19
-
20
-
**In This Topic**
21
-
22
-
-**Before you begin:**
23
-
24
-
[Security](#Security)
25
-
26
-
-**To enable or disable backup checksums, using:**
27
-
28
-
[SQL Server Management Studio](#SSMSProcedure)
29
-
30
-
[Transact-SQL](#TsqlProcedure)
31
-
32
-
## <aname="BeforeYouBegin"></a> Before You Begin
33
-
34
-
### <aname="Security"></a> Security
35
-
36
-
#### <aname="Permissions"></a> Permissions
37
-
BACKUP
38
-
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.
39
-
40
-
Ownership and permission problems on the backup device's physical file can interfere with a backup operation. [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] must be able to read and write to the device; the account under which the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] service runs must have write permissions. However, [sp_addumpdevice](../../relational-databases/system-stored-procedures/sp-addumpdevice-transact-sql.md), which adds an entry for a backup device in the system tables, does not check file access permissions. Such problems on the backup device's physical file may not appear until the physical resource is accessed when the backup or restore is attempted.
41
-
42
-
RESTORE
43
-
If the database being restored does not 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).
44
-
45
-
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 is not always the case when RESTORE is executed, members of the **db_owner** fixed database role do not have RESTORE permissions.
46
-
47
-
## <aname="SSMSProcedure"></a> Using SQL Server Management Studio
48
-
49
-
#### To enable or disable checksums during a backup operation
50
-
51
-
1. Follow the steps to [create a database backup](../../relational-databases/backup-restore/create-a-full-database-backup-sql-server.md).
52
-
53
-
2. On the **Options** page, in the **Reliability** section, click **Perform checksum before writing to media**.
54
-
55
-
## <aname="TsqlProcedure"></a> Using Transact-SQL
56
-
57
-
#### To enable or disable backup checksum for a backup operation
58
-
59
-
1. Connect to the [!INCLUDE[ssDE](../../includes/ssde-md.md)].
60
-
61
-
2. From the Standard bar, click **New Query**.
62
-
63
-
3. To enable backup checksums in a [BACKUP](../../t-sql/statements/backup-transact-sql.md) statement, specify the WITH CHECKSUM option. To disable backup checksums, specify the WITH NO_CHECKSUM option. This is the default behavior, except for a compressed backup. The following example specifies that checksums be performed.
64
-
65
-
```sql
66
-
BACKUP DATABASE AdventureWorks2022
67
-
TO DISK ='Z:\SQLServerBackups\AdvWorksData.bak'
68
-
WITH CHECKSUM;
69
-
GO
70
-
```
71
-
72
-
#### To enable or disable backup checksum for a restore operation
73
-
74
-
1. Connect to the [!INCLUDE[ssDE](../../includes/ssde-md.md)].
75
-
76
-
2. From the Standard bar, click **New Query**.
77
-
78
-
3. To enable backup checksums in a [RESTORE](../../t-sql/statements/restore-statements-transact-sql.md) statement, specify the WITH CHECKSUM option. This is the default behavior for a compressed backup. To disable backup checksums, specify the WITH NO_CHECKSUM option. This is the default behavior, except for a compressed backup. The following example specifies that backup checksums be performed.
This article describes how to enable or disable backup checksums when you're backing up or restoring a database in [!INCLUDE [ssnoversion](../../includes/ssnoversion-md.md)] by using [!INCLUDE [ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE [tsql](../../includes/tsql-md.md)].
21
+
22
+
## Permissions
23
+
24
+
#### BACKUP
25
+
26
+
`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.
27
+
28
+
Ownership and permission problems on the backup device's physical file can interfere with a backup operation. [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] must be able to read and write to the device; the account under which the [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] service runs must have write permissions. However, [sp_addumpdevice](../system-stored-procedures/sp-addumpdevice-transact-sql.md), 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.
29
+
30
+
#### RESTORE
31
+
32
+
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).
33
+
34
+
`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.
35
+
36
+
## <aid="SSMSProcedure"></a> Use SQL Server Management Studio
37
+
38
+
#### Enable or disable checksums during a backup operation
39
+
40
+
1. Follow the steps to [create a database backup](create-a-full-database-backup-sql-server.md).
41
+
42
+
1. On the **Options** page, in the **Reliability** section, select **Perform checksum before writing to media**.
43
+
44
+
## <aid="TsqlProcedure"></a> Use Transact-SQL
45
+
46
+
#### Enable or disable backup checksum for a backup operation
47
+
48
+
1. Connect to the [!INCLUDE [ssDE](../../includes/ssde-md.md)].
49
+
50
+
1. From the Standard bar, select **New Query**.
51
+
52
+
1. To enable backup checksums in a [BACKUP (Transact-SQL)](../../t-sql/statements/backup-transact-sql.md) statement, specify the `WITH CHECKSUM` option. To disable backup checksums, specify the `WITH NO_CHECKSUM` option. This is the default behavior, except for a compressed backup. The following example specifies that checksums be performed.
53
+
54
+
```sql
55
+
BACKUP DATABASE AdventureWorks2022
56
+
TO DISK ='Z:\SQLServerBackups\AdvWorksData.bak'
57
+
WITH CHECKSUM;
58
+
GO
59
+
```
60
+
61
+
#### Enable or disable backup checksum for a restore operation
62
+
63
+
1. Connect to the [!INCLUDE [ssDE](../../includes/ssde-md.md)].
64
+
65
+
1. From the Standard bar, select **New Query**.
66
+
67
+
1. To enable backup checksums in a [RESTORE Statements (Transact-SQL)](../../t-sql/statements/restore-statements-transact-sql.md) statement, specify the `WITH CHECKSUM` option. This is the default behavior for a compressed backup. To disable backup checksums, specify the `WITH NO_CHECKSUM` option. This is the default behavior, except for a compressed backup. The following example specifies that backup checksums be performed.
68
+
69
+
```sql
70
+
RESTORE DATABASE AdventureWorks2022
71
+
FROM DISK ='Z:\SQLServerBackups\AdvWorksData.bak'
72
+
WITH CHECKSUM;
73
+
GO
74
+
```
75
+
87
76
> [!WARNING]
88
-
> 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 are not present.
[Possible Media Errors During Backup and Restore (SQL Server)](../../relational-databases/backup-restore/possible-media-errors-during-backup-and-restore-sql-server.md)
99
-
[Specify Whether a Backup or Restore Operation Continues or Stops After Encountering an Error (SQL Server)](../../relational-databases/backup-restore/specify-if-backup-or-restore-continues-or-stops-after-error.md)
100
-
101
-
77
+
> 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.
0 commit comments