Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 79d022b

Browse files
committed
backup MI support
1 parent 497264b commit 79d022b

1 file changed

Lines changed: 47 additions & 30 deletions

File tree

docs/t-sql/statements/backup-transact-sql.md

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "BACKUP (Transact-SQL) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "01/22/2018"
4+
ms.date: "03/30/2018"
55
ms.prod: "sql-non-specified"
66
ms.prod_service: "sql-database"
77
ms.service: ""
@@ -55,9 +55,11 @@ manager: "craigg"
5555
ms.workload: "Active"
5656
---
5757
# BACKUP (Transact-SQL)
58-
[!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)]
58+
[!INCLUDE[tsql-appliesto-ss-asdbmi-xxxx-xxx-md](../../includes/appliesto-ss-asdbmi-xxxx-xxx-md.md )]
5959

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).
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).
61+
62+
[!INCLUDE[ssMIlimitation](../../includes/sql-db-mi-limitation.md)]
6163

6264
![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
6365

@@ -68,7 +70,8 @@ Backing Up a Whole Database
6870
BACKUP DATABASE { database_name | @database_name_var }
6971
TO <backup_device> [ ,...n ]
7072
[ <MIRROR TO clause> ] [ next-mirror-to ]
71-
[ WITH { DIFFERENTIAL | <general_WITH_options> [ ,...n ] } ]
73+
[ WITH { DIFFERENTIAL -- Not supporterd in SQL Database Managed Instance
74+
| <general_WITH_options> [ ,...n ] } ]
7275
[;]
7376
7477
Backing Up Specific Files or Filegroups
@@ -88,7 +91,8 @@ BACKUP DATABASE { database_name | @database_name_var }
8891
[;]
8992
9093
Backing Up the Transaction Log (full and bulk-logged recovery models)
91-
BACKUP LOG { database_name | @database_name_var }
94+
BACKUP LOG -- Not supported in SQL Database Managed Instance
95+
{ database_name | @database_name_var }
9296
TO <backup_device> [ ,...n ]
9397
[ <MIRROR TO clause> ] [ next-mirror-to ]
9498
[ WITH { <general_WITH_options> | \<log-specific_optionspec> } [ ,...n ] ]
@@ -97,7 +101,9 @@ BACKUP LOG { database_name | @database_name_var }
97101
<backup_device>::=
98102
{
99103
{ logical_device_name | @logical_device_name_var }
100-
| { DISK | TAPE | URL} =
104+
| { DISK -- Not supported in SQL Database Managed Instance
105+
| TAPE -- Not supported in SQL Database Managed Instance
106+
| URL } =
101107
{ 'physical_device_name' | @physical_device_name_var | 'NUL' }
102108
}
103109
@@ -115,13 +121,13 @@ FILEGROUP = { logical_filegroup_name | @logical_filegroup_name_var }
115121
116122
<general_WITH_options> [ ,...n ]::=
117123
--Backup Set Options
118-
COPY_ONLY
124+
COPY_ONLY -- Only backup set option supported by SQL Database Managed Instance
119125
| { COMPRESSION | NO_COMPRESSION }
120126
| DESCRIPTION = { 'text' | @text_variable }
121127
| NAME = { backup_set_name | @backup_set_name_var }
122128
| CREDENTIAL
123129
| ENCRYPTION
124-
| FILE_SNAPSHOT
130+
| FILE_SNAPSHOT --Not supported in SQL Database Managed Instance
125131
| { EXPIREDATE = { 'date' | @date_var }
126132
| RETAINDAYS = { days | @days_var } }
127133
@@ -147,11 +153,11 @@ FILEGROUP = { logical_filegroup_name | @logical_filegroup_name_var }
147153
--Monitoring Options
148154
STATS [ = percentage ]
149155
150-
--Tape Options
156+
--Tape Options. These are not supported in SQL Database Managed Instance
151157
{ REWIND | NOREWIND }
152158
| { UNLOAD | NOUNLOAD }
153159
154-
--Log-specific Options
160+
--Log-specific Options. These are not supported in SQL Database Managed Instance
155161
{ NORECOVERY | STANDBY = undo_file_name }
156162
| NO_TRUNCATE
157163
@@ -161,15 +167,18 @@ FILEGROUP = { logical_filegroup_name | @logical_filegroup_name_var }
161167
```
162168

163169
## Arguments
164-
DATABASE
170+
171+
DATABASE
165172
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.
166173

167174
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.
168175

169176
> [!NOTE]
170177
> Only a full database backup can be performed on the **master** database.
171178
172-
LOG
179+
LOG
180+
**Applies to:** SQL Server
181+
173182
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.
174183

175184
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* ]
221230
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).
222231

223232
\<backup_device>
233+
**Applies to:** SQL Server
224234
Specifies a logical or physical backup device to use for the backup operation.
225235

226-
{ *logical_device_name* | **@***logical_device_name_var* }
236+
{ *logical_device_name* | **@***logical_device_name_var* }
237+
**Applies to:** SQL Server
227238
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.
228239

229-
{ DISK | TAPE | URL} **=** { **'***physical_device_name***'** | **@***physical_device_name_var* | 'NUL' }
240+
{ DISK | TAPE | URL} **=** { **'***physical_device_name***'** | **@***physical_device_name_var* | 'NUL' }
241+
**Applies to:** DISK, TAPE, and URL apply to SQL Server. Only URL applies to SQL Database Managed Instance
230242
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).
231243

232244
> [!NOTE]
@@ -235,7 +247,7 @@ TO \<backup_device> [ **,**...*n* ]
235247
> [!IMPORTANT]
236248
> 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).
237249
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.
239251

240252
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.
241253

@@ -273,17 +285,17 @@ See "\<backup_device>," earlier in this section.
273285
Specifies options to be used with a backup operation.
274286

275287
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.
276289
Used only when creating a backup to the Windows Azure Blob storage service.
277290

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+
281294
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+
285296
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.
287299

288300
> [!NOTE]
289301
> 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
314326
> [!NOTE]
315327
> 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 &#40;Transact-SQL&#41;](../../t-sql/statements/restore-statements-arguments-transact-sql.md).
316328
317-
COPY_ONLY
329+
COPY_ONLY
330+
**Applies to:** SQL Server and SQL Database Managed Instance
318331
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.
319332

320333
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.
@@ -505,14 +518,16 @@ STATS [ **=** *percentage* ]
505518
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.
506519

507520
**Tape Options**
508-
521+
**Applies to:** SQL Server
509522
These options are used only for TAPE devices. If a nontape device is being used, these options are ignored.
510523

511524
{ **REWIND** | NOREWIND }
512-
REWIND
525+
REWIND
526+
**Applies to:** SQL Server
513527
Specifies that [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] releases and rewinds the tape. REWIND is the default.
514528

515-
NOREWIND
529+
NOREWIND
530+
**Applies to:** SQL Server
516531
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.
517532

518533
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
521536
> 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 &#40;SQL Server&#41;](../../relational-databases/backup-restore/backup-devices-sql-server.md).
522537
523538
{ **UNLOAD** | NOUNLOAD }
524-
539+
**Applies to:** SQL Server
525540
> [!NOTE]
526541
> `UNLOAD` and `NOUNLOAD` are session settings that persist for the life of the session or until it is reset by specifying the alternative.
527542
@@ -535,7 +550,7 @@ NOUNLOAD
535550
> 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.
536551
537552
**Log-specific options**
538-
553+
**Applies to:** SQL Server
539554
These options are only used with `BACKUP LOG`.
540555

541556
> [!NOTE]
@@ -704,7 +719,8 @@ Starting with [!INCLUDE[ssSQL15](../../includes/sssql15-md.md)], this enables an
704719

705720
> [!NOTE]
706721
> 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.
708724
> * 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`).
709725

710726
By default, every successful backup operation adds an entry in the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] error log and in 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 &#40;Transact-SQL&#41;](../../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 *
750766
- F. [Creating and backing up to a multifamily mirrored media set](#create_multifamily_mirrored_media_set)
751767
- G [Backing up to an existing mirrored media set](#existing_mirrored_media_set)
752768
- 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+
- )
754771

755772
> [!NOTE]
756773
> The backup how-to topics contain additional examples. For more information, see [Backup Overview &#40;SQL Server&#41;](../../relational-databases/backup-restore/backup-overview-sql-server.md).

0 commit comments

Comments
 (0)