Skip to content

Commit 3852e6d

Browse files
Merge pull request #34292 from rwestMSFT/rw-0603-fix-copy-only
Remove ambiguity in copy-only backup article
2 parents ae403d0 + 86eada2 commit 3852e6d

File tree

1 file changed

+37
-25
lines changed

1 file changed

+37
-25
lines changed

docs/relational-databases/backup-restore/copy-only-backups-sql-server.md

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: Copy-only backups
2+
title: Copy-Only Backups
33
description: A copy-only backup is a SQL Server backup that is independent of the sequence of SQL Server backups. It doesn't affect how later backups are restored.
44
author: MashaMSFT
55
ms.author: mathoma
66
ms.reviewer: randolphwest
7-
ms.date: 12/28/2023
7+
ms.date: 06/03/2025
88
ms.service: sql
99
ms.subservice: backup-restore
1010
ms.topic: conceptual
@@ -20,30 +20,37 @@ monikerRange: "=azuresqldb-mi-current || >=sql-server-2016 || >=sql-server-linux
2020

2121
A *copy-only backup* is a [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] backup that is independent of the sequence of conventional [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] backups. Usually, taking a backup changes the database and affects how later backups are restored. However, occasionally, it's useful to take a backup for a special purpose without affecting the overall backup and restore procedures for the database. Copy-only backups serve this purpose.
2222

23+
## Types of copy-only backups
24+
2325
The types of copy-only backups are as follows:
2426

25-
- **Copy-only full backups (all recovery models)**
27+
### Copy-only full backups (all recovery models)
28+
29+
- A copy-only *full* backup can't serve as a differential base or differential backup and doesn't affect the differential base.
2630

27-
- A copy-only backup can't serve as a differential base or differential backup and doesn't affect the differential base.
31+
- Restoring a copy-only full backup is the same as restoring any other full backup.
2832

29-
- Restoring a copy-only full backup is the same as restoring any other full backup.
33+
### Copy-only log backups (full recovery model and bulk-logged recovery model only)
3034

31-
- **Copy-only log backups (full recovery model and bulk-logged recovery model only)**
35+
- A copy-only *log* backup preserves the existing log archive point and, therefore, doesn't affect the sequencing of regular log backups. Copy-only log backups are typically unnecessary. Instead, you can create a new routine log backup, and restore that backup (using the `WITH NORECOVERY` option) together with any previous log backups that are required for the restore sequence.
3236

33-
- A copy-only log backup preserves the existing log archive point and, therefore, doesn't affect the sequencing of regular log backups. Copy-only log backups are typically unnecessary. Instead, you can create a new routine log backup (using `WITH NORECOVERY`) and use that backup together with any previous log backups that are required for the restore sequence. However, a copy-only log backup can sometimes be useful for performing an online restore. For more information, follow the instructions in the article [Example: Online restore of a read-write file (full recovery model)](example-online-restore-of-a-read-write-file-full-recovery-model.md), using the copy-only backup files instead.
37+
A copy-only log backup can sometimes be useful for performing an online restore. For more information, follow the instructions in the article [Example: Online restore of a read-write file (full recovery model)](example-online-restore-of-a-read-write-file-full-recovery-model.md), using the copy-only backup files instead.
3438

35-
- The transaction log is never truncated after a copy-only backup.
39+
- The transaction log is never truncated after a copy-only backup.
3640

37-
Copy-only backups are recorded in the `is_copy_only` column of the [backupset](../../relational-databases/system-tables/backupset-transact-sql.md) table.
41+
## Remarks
3842

39-
> [!IMPORTANT]
40-
> In [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)], copy-only backups can't be created for a database encrypted with [service-managed Transparent Data Encryption (TDE)](/azure/sql-database/transparent-data-encryption-azure-sql?tabs=azure-portal#service-managed-transparent-data-encryption). Service-managed TDE uses internal key for encryption of data, and that key can't be exported, so you couldn't restore the backup anywhere else. Consider using [customer-managed TDE](/azure/sql-database/transparent-data-encryption-byok-azure-sql) instead to be able to create copy-only backups of encrypted databases, but make sure to have encryption key available for later restore.
43+
Copy-only backups are recorded in the `is_copy_only` column of the [backupset](../system-tables/backupset-transact-sql.md) table.
44+
45+
In [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)], copy-only backups can't be created for a database encrypted with [service-managed Transparent Data Encryption (TDE)](/azure/sql-database/transparent-data-encryption-azure-sql?tabs=azure-portal#service-managed-transparent-data-encryption). Service-managed TDE uses internal key for encryption of data, and that key can't be exported, so you couldn't restore the backup anywhere else. Consider using [customer-managed TDE](/azure/sql-database/transparent-data-encryption-byok-azure-sql) instead to be able to create copy-only backups of encrypted databases, but make sure to have encryption key available for later restore.
4146

4247
## Create a copy-only backup
4348

4449
You can create a copy-only backup with [!INCLUDE [ssManStudioFull](../../includes/ssmanstudiofull-md.md)], [!INCLUDE [azure-data-studio](../../includes/azure-data-studio-short.md)], [!INCLUDE [tsql](../../includes/tsql-md.md)], or PowerShell.
4550

46-
### <a id="SSMSProcedure"></a> A. Use SQL Server Management Studio
51+
<a id="SSMSProcedure"></a>
52+
53+
### A. Use SQL Server Management Studio
4754

4855
In this example, a copy-only backup of the `Sales` database is backed up to disk at the default backup location.
4956

@@ -55,7 +62,9 @@ In this example, a copy-only backup of the `Sales` database is backed up to disk
5562

5663
1. Select **OK**.
5764

58-
### <a id="TsqlProcedure"></a> B. Use Transact-SQL
65+
<a id="TsqlProcedure"></a>
66+
67+
### B. Use Transact-SQL
5968

6069
This example creates a copy-only backup for the `Sales` database utilizing the `COPY_ONLY` parameter. A copy-only backup of the transaction log is taken as well.
6170

@@ -72,15 +81,17 @@ WITH COPY_ONLY;
7281
> [!NOTE]
7382
> `COPY_ONLY` has no effect when specified with the `DIFFERENTIAL` option.
7483
75-
### <a id="TsqlProcedureManagedInstance"></a> C. Use Transact-SQL and Azure SQL Managed Instance
84+
<a id="TsqlProcedureManagedInstance"></a>
85+
86+
### C. Use Transact-SQL and Azure SQL Managed Instance
7687

77-
Azure SQL Managed Instance supports taking COPY_ONLY full backups. The example performs a COPY_ONLY backup of `MyDatabase` to the Microsoft Azure Blob Storage. The storage Account name is `mystorageaccount`. The container is called `myfirstcontainer`. A storage access policy has been created with read, write, delete, and list rights. The [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] credential, `https://mystorageaccount.blob.core.windows.net/myfirstcontainer`, was created using a Shared Access Signature that is associated with the Storage Access Policy secret. For information on [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] backup to the Microsoft Azure Blob Storage, see [SQL Server Backup and Restore with Microsoft Azure Blob Storage](../../relational-databases/backup-restore/sql-server-backup-and-restore-with-microsoft-azure-blob-storage-service.md) and [SQL Server Backup to URL](../../relational-databases/backup-restore/sql-server-backup-to-url.md).
88+
Azure SQL Managed Instance supports taking `COPY_ONLY` full backups. The example performs a `COPY_ONLY` backup of `MyDatabase` to the Microsoft Azure Blob Storage. The storage Account name is `mystorageaccount`. The container is called `myfirstcontainer`. A storage access policy is created with read, write, delete, and list rights. The [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] credential, `https://mystorageaccount.blob.core.windows.net/myfirstcontainer`, was created using a Shared Access Signature that is associated with the Storage Access Policy secret. For information on [!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] backup to the Microsoft Azure Blob Storage, see [SQL Server backup and restore with Azure Blob Storage](sql-server-backup-and-restore-with-microsoft-azure-blob-storage-service.md) and [SQL Server backup to URL for Microsoft Azure Blob Storage](sql-server-backup-to-url.md).
7889

7990
```sql
8091
-- Prerequisite to have write permissions
8192
CREATE CREDENTIAL [https://mystorageaccount.blob.core.windows.net/myfirstcontainer]
8293
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
83-
SECRET = 'sp=...' -- Enter your secret SAS token here.
94+
SECRET = 'sp=...'; -- Enter your secret SAS token here.
8495

8596
BACKUP DATABASE MyDatabase
8697
TO URL = 'https://mystorageaccount.blob.core.windows.net/myfirstcontainer/MyDatabaseBackup.bak'
@@ -96,10 +107,11 @@ URL = 'https://mystorageaccount.blob.core.windows.net/myfirstcontainer/MyDatabas
96107
URL = 'https://mystorageaccount.blob.core.windows.net/myfirstcontainer/MyDatabase-03.bak',
97108
URL = 'https://mystorageaccount.blob.core.windows.net/myfirstcontainer/MyDatabase-04.bak'
98109
WITH COPY_ONLY;
99-
100110
```
101111

102-
### <a id="PowerShellProcedure"></a> D. Use PowerShell
112+
<a id="PowerShellProcedure"></a>
113+
114+
### D. Use PowerShell
103115

104116
This example creates a copy-only backup for the `Sales` database utilizing the `-CopyOnly` parameter.
105117

@@ -111,22 +123,22 @@ Backup-SqlDatabase -ServerInstance 'SalesServer' -Database 'Sales' -BackupFile '
111123

112124
### Create a full or log backup
113125

114-
- [Create a Full Database Backup (SQL Server)](create-a-full-database-backup-sql-server.md)
115-
- [Back Up a Transaction Log (SQL Server)](back-up-a-transaction-log-sql-server.md)
126+
- [Create a Full Database Backup](create-a-full-database-backup-sql-server.md)
127+
- [Back up a transaction log](back-up-a-transaction-log-sql-server.md)
116128

117129
### View copy-only backups
118130

119-
- [backupset (Transact-SQL)](../../relational-databases/system-tables/backupset-transact-sql.md)
131+
- [backupset (Transact-SQL)](../system-tables/backupset-transact-sql.md)
120132

121133
### Set up and use the SQL Server PowerShell provider
122134

123135
- [SQL Server PowerShell Provider](/powershell/sql-server/sql-server-powershell-provider)
124136

125137
## Related content
126138

127-
- [Backup Overview (SQL Server)](backup-overview-sql-server.md)
128-
- [Recovery Models (SQL Server)](recovery-models-sql-server.md)
129-
- [Copy Databases with Backup and Restore](../../relational-databases/databases/copy-databases-with-backup-and-restore.md)
130-
- [Restore and Recovery Overview (SQL Server)](restore-and-recovery-overview-sql-server.md)
139+
- [Backup overview (SQL Server)](backup-overview-sql-server.md)
140+
- [Recovery models (SQL Server)](recovery-models-sql-server.md)
141+
- [Copy Databases with Backup and Restore](../databases/copy-databases-with-backup-and-restore.md)
142+
- [Restore and recovery overview (SQL Server)](restore-and-recovery-overview-sql-server.md)
131143
- [BACKUP (Transact-SQL)](../../t-sql/statements/backup-transact-sql.md)
132144
- [Backup-SqlDatabase](/powershell/module/sqlserver/backup-sqldatabase)

0 commit comments

Comments
 (0)