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
Copy file name to clipboardExpand all lines: docs/relational-databases/backup-restore/copy-only-backups-sql-server.md
+37-25Lines changed: 37 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
---
2
-
title: Copy-only backups
2
+
title: Copy-Only Backups
3
3
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.
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.
22
22
23
+
## Types of copy-only backups
24
+
23
25
The types of copy-only backups are as follows:
24
26
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.
26
30
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.
28
32
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)
30
34
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.
32
36
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.
34
38
35
-
- The transaction log is never truncated after a copy-only backup.
39
+
- The transaction log is never truncated after a copy-only backup.
36
40
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
38
42
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.
41
46
42
47
## Create a copy-only backup
43
48
44
49
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.
45
50
46
-
### <aid="SSMSProcedure"></a> A. Use SQL Server Management Studio
51
+
<aid="SSMSProcedure"></a>
52
+
53
+
### A. Use SQL Server Management Studio
47
54
48
55
In this example, a copy-only backup of the `Sales` database is backed up to disk at the default backup location.
49
56
@@ -55,7 +62,9 @@ In this example, a copy-only backup of the `Sales` database is backed up to disk
55
62
56
63
1. Select **OK**.
57
64
58
-
### <aid="TsqlProcedure"></a> B. Use Transact-SQL
65
+
<aid="TsqlProcedure"></a>
66
+
67
+
### B. Use Transact-SQL
59
68
60
69
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.
61
70
@@ -72,15 +81,17 @@ WITH COPY_ONLY;
72
81
> [!NOTE]
73
82
> `COPY_ONLY` has no effect when specified with the `DIFFERENTIAL` option.
74
83
75
-
### <aid="TsqlProcedureManagedInstance"></a> C. Use Transact-SQL and Azure SQL Managed Instance
84
+
<aid="TsqlProcedureManagedInstance"></a>
85
+
86
+
### C. Use Transact-SQL and Azure SQL Managed Instance
76
87
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).
0 commit comments