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
Backs up a complete [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] database to create a database backup, or one or more files or filegroups of the database to create a file backup (BACKUP DATABASE). Also, under the full recovery model or bulk-logged recovery model, backs up the transaction log of the database to create a log backup (BACKUP LOG).
60
+
Backs up a complete [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] database to create a database backup, or one or more files or filegroups of the database to create a file backup (BACKUP DATABASE). Also, under the full recovery model or bulk-logged recovery model, backs up the transaction log of the database to create a log backup (BACKUP LOG).
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
Specifies a complete database backup. If a list of files and filegroups is specified, only those files and filegroups are backed up. During a full or differential database backup, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] backs up enough of the transaction log to produce a consistent database when the backup is restored.
166
173
167
174
When you restore a backup created by BACKUP DATABASE (a *data backup*), the entire backup is restored. Only a log backup can be restored to a specific time or transaction within the backup.
168
175
169
176
> [!NOTE]
170
177
> Only a full database backup can be performed on the **master** database.
171
178
172
-
LOG
179
+
LOG
180
+
**Applies to:** SQL Server
181
+
173
182
Specifies a backup of the transaction log only. The log is backed up from the last successfully executed log backup to the current end of the log. Before you can create the first log backup, you must create a full backup.
174
183
175
184
You can restore a log backup to a specific time or transaction within the backup by specifying `WITH STOPAT`, `STOPATMARK`, or `STOPBEFOREMARK` in your [RESTORE LOG](../../t-sql/statements/restore-statements-transact-sql.md) statement.
@@ -221,12 +230,15 @@ TO \<backup_device> [ **,**...*n* ]
221
230
Indicates that the accompanying set of [backup devices](../../relational-databases/backup-restore/backup-devices-sql-server.md) is either an unmirrored media set or the first of the mirrors within a mirrored media set (for which one or more MIRROR TO clauses are declared).
222
231
223
232
\<backup_device>
233
+
**Applies to:** SQL Server
224
234
Specifies a logical or physical backup device to use for the backup operation.
Is the logical name of the backup device to which the database is backed up. The logical name must follow the rules for identifiers. If supplied as a variable (@*logical_device_name_var*), the backup device name can be specified either as a string constant (@*logical_device_name_var***=** logical backup device name) or as a variable of any character string data type except for the **ntext** or **text** data types.
**Applies to:** DISK, TAPE, and URL apply to SQL Server. Only URL applies to SQL Database Managed Instance
230
242
Specifies a disk file or tape device, or a Windows Azure Blob storage service. The URL format is used for creating backups to the Windows Azure storage service. For more information and examples, see [SQL Server Backup and Restore with Microsoft Azure Blob Storage Service](../../relational-databases/backup-restore/sql-server-backup-and-restore-with-microsoft-azure-blob-storage-service.md). For a tutorial, see [Tutorial: SQL Server Backup and Restore to Windows Azure Blob Storage Service](~/relational-databases/tutorial-sql-server-backup-and-restore-to-azure-blob-storage-service.md).
231
243
232
244
> [!NOTE]
@@ -235,7 +247,7 @@ TO \<backup_device> [ **,**...*n* ]
235
247
> [!IMPORTANT]
236
248
> Starting with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] SP1 CU2 through [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)], you can only backup to a single device when backing up to URL. In order to backup to multiple devices when backing up to URL, you must use [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and you must use Shared Access Signature (SAS) tokens. For examples creating a Shared Access Signature, see [SQL Server Backup to URL](../../relational-databases/backup-restore/sql-server-backup-to-url.md) and [Simplifying creation of SQL Credentials with Shared Access Signature (SAS) tokens on Azure Storage with Powershell](http://blogs.msdn.com/b/sqlcat/archive/2015/03/21/simplifying-creation-sql-credentials-with-shared-access-signature-sas-keys-on-azure-storage-containers-with-powershell.aspx).
237
249
238
-
**URL applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] SP1 CU2 through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]).
250
+
**URL applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] SP1 CU2 through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]) and SQL Database Managed Instance.
239
251
240
252
A disk device does not have to exist before it is specified in a BACKUP statement. If the physical device exists and the INIT option is not specified in the BACKUP statement, the backup is appended to the device.
241
253
@@ -273,17 +285,17 @@ See "\<backup_device>," earlier in this section.
273
285
Specifies options to be used with a backup operation.
274
286
275
287
CREDENTIAL
288
+
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] SP1 CU2 through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]) and SQL Database Managed Instance.
276
289
Used only when creating a backup to the Windows Azure Blob storage service.
277
290
278
-
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] SP1 CU2 through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]).
279
-
280
-
FILE_SNAPSHOT
291
+
FILE_SNAPSHOT
292
+
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]).
293
+
281
294
Used to create an Azure snapshot of the database files when all of the SQL Server database files are stored using the Azure Blob storage service. For more information, see [SQL Server Data Files in Microsoft Azure](../../relational-databases/databases/sql-server-data-files-in-microsoft-azure.md). [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Snapshot Backup takes Azure snapshots of the database files (data and log files) at a consistent state. A consistent set of Azure snapshots make up a backup and are recorded in the backup file. The only difference between `BACKUP DATABASE TO URL WITH FILE_SNAPSHOT` and `BACKUP LOG TO URL WITH FILE_SNAPSHOT` is that the latter also truncates the transaction log while the former does not. With [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Snapshot Backup, after the initial full backup that is required by [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] to establish the backup chain, only a single transaction log backup is required to restore a database to the point in time of the transaction log backup. Furthermore, only two transaction log backups are required to restore a database to a point in time between the time of the two transaction log backups.
282
-
283
-
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL15](../../includes/sssql15-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)]).
284
-
295
+
285
296
DIFFERENTIAL
286
-
Used only with BACKUP DATABASE, specifies that the database or file backup should consist only of the portions of the database or file changed since the last full backup. A differential backup usually takes up less space than a full backup. Use this option so that all individual log backups performed since the last full backup do not have to be applied.
297
+
**Applies to:** SQL Server
298
+
Used only with BACKUP DATABASE, specifies that the database or file backup should consist only of the portions of the database or file changed since the last full backup. A differential backup usually takes up less space than a full backup. Use this option so that all individual log backups performed since the last full backup do not have to be applied.
287
299
288
300
> [!NOTE]
289
301
> By default, `BACKUP DATABASE` creates a full backup.
@@ -314,7 +326,8 @@ These options operate on the backup set that is created by this backup operation
314
326
> [!NOTE]
315
327
> To specify a backup set for a restore operation, use the `FILE = <backup_set_file_number>` option. For more information about how to specify a backup set, see "Specifying a Backup Set" in [RESTORE Arguments (Transact-SQL)](../../t-sql/statements/restore-statements-arguments-transact-sql.md).
316
328
317
-
COPY_ONLY
329
+
COPY_ONLY
330
+
**Applies to:** SQL Server and SQL Database Managed Instance
318
331
Specifies that the backup is a *copy-only backup*, which does not affect the normal sequence of backups. A copy-only backup is created independently of your regularly scheduled, conventional backups. A copy-only backup does not affect your overall backup and restore procedures for the database.
319
332
320
333
Copy-only backups should be used in situations in which a backup is taken for a special purpose, such as backing up the log before an online file restore. Typically, a copy-only log backup is used once and then deleted.
The STATS option reports the percentage complete as of the threshold for reporting the next interval. This is at approximately the specified percentage; for example, with STATS=10, if the amount completed is 40 percent, the option might display 43 percent. For large backup sets, this is not a problem, because the percentage complete moves very slowly between completed I/O calls.
506
519
507
520
**Tape Options**
508
-
521
+
**Applies to:** SQL Server
509
522
These options are used only for TAPE devices. If a nontape device is being used, these options are ignored.
510
523
511
524
{ **REWIND** | NOREWIND }
512
-
REWIND
525
+
REWIND
526
+
**Applies to:** SQL Server
513
527
Specifies that [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] releases and rewinds the tape. REWIND is the default.
514
528
515
-
NOREWIND
529
+
NOREWIND
530
+
**Applies to:** SQL Server
516
531
Specifies that [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] will keep the tape open after the backup operation. You can use this option to help improve performance when performing multiple backup operations to a tape.
517
532
518
533
NOREWIND implies NOUNLOAD, and these options are incompatible within a single BACKUP statement.
@@ -521,7 +536,7 @@ NOREWIND implies NOUNLOAD, and these options are incompatible within a single BA
521
536
> If you use `NOREWIND`, the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] retains ownership of the tape drive until a BACKUP or RESTORE statement that is running in the same process uses either the `REWIND` or `UNLOAD` option, or the server instance is shut down. Keeping the tape open prevents other processes from accessing the tape. For information about how to display a list of open tapes and to close an open tape, see [Backup Devices (SQL Server)](../../relational-databases/backup-restore/backup-devices-sql-server.md).
522
537
523
538
{ **UNLOAD** | NOUNLOAD }
524
-
539
+
**Applies to:** SQL Server
525
540
> [!NOTE]
526
541
> `UNLOAD` and `NOUNLOAD` are session settings that persist for the life of the session or until it is reset by specifying the alternative.
527
542
@@ -535,7 +550,7 @@ NOUNLOAD
535
550
> For a backup to a tape backup device, the `BLOCKSIZE` option to affect the performance of the backup operation. This option typically affects performance only when writing to tape devices.
536
551
537
552
**Log-specific options**
538
-
553
+
**Applies to:** SQL Server
539
554
These options are only used with `BACKUP LOG`.
540
555
541
556
> [!NOTE]
@@ -704,7 +719,8 @@ Starting with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)], this enables an
704
719
705
720
> [!NOTE]
706
721
> The optimized compression algorithm for TDE encrypted databases is used automatically when:
707
-
>* Backup to URL is used, in which case the default `MAXTRANSFERSIZE` is changed to 1048576 (1 MB), and is not forced to a lower value.
722
+
>*
723
+
> is used, in which case the default `MAXTRANSFERSIZE` is changed to 1048576 (1 MB), and is not forced to a lower value.
708
724
>* The database has multiple data files, in which case the default `MAXTRANSFERSIZE` is changed to a multiple of 65536 (64 KB) is not changed to a lower value (such as`MAXTRANSFERSIZE = 65536`).
709
725
710
726
By default, every successful backup operation adds an entry in the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] error log andin the system event log. If back up the log very frequently, these success messages accumulate quickly, resulting in huge error logs that can make finding other messages difficult. In such cases you can suppress these log entries by using trace flag 3226 if none of your scripts depend on those entries. For more information, see [Trace Flags (Transact-SQL)](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md).
@@ -750,7 +766,8 @@ When a restore is performed, if the backup set was not already recorded in the *
750
766
- F. [Creating and backing up to a multifamily mirrored media set](#create_multifamily_mirrored_media_set)
751
767
- G [Backing up to an existing mirrored media set](#existing_mirrored_media_set)
752
768
- H. [Creating a compressed backup in a new media set](#creating_compressed_backup_new_media_set)
753
-
- I. [Backing up to the Microsoft Azure Blob storage service](#url)
769
+
- I. [Backing up to the Microsoft Azure Blob storage service](#
770
+
- )
754
771
755
772
> [!NOTE]
756
773
> The backup how-to topics contain additional examples. For more information, see [Backup Overview (SQL Server)](../../relational-databases/backup-restore/backup-overview-sql-server.md).
0 commit comments