Skip to content

Latest commit

 

History

History
114 lines (94 loc) · 6.79 KB

restore-statements-labelonly-transact-sql.md

File metadata and controls

114 lines (94 loc) · 6.79 KB
title ms.custom ms.date ms.prod ms.prod_service ms.reviewer ms.technology ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid author ms.author monikerRange
RESTORE LABELONLY (Transact-SQL) | Microsoft Docs
03/30/2018
sql
sql-database
t-sql
language-reference
LABELONLY
RESTORE_LABELONLY_TSQL
LABELONLY_TSQL
RESTORE LABELONLY
TSQL
RESTORE LABELONLY statement
backup media [SQL Server], content information
7cf0641e-0d55-4ffb-9500-ecd6ede85ae5
MikeRayMSFT
mikeray
=azuresqldb-mi-current||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017

RESTORE Statements - LABELONLY (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-asdbmi-xxxx-xxx-md] Returns a result set containing information about the backup media identified by the given backup device.

Note

For the descriptions of the arguments, see RESTORE Arguments (Transact-SQL).

Topic link icon Transact-SQL Syntax Conventions

Syntax

  
RESTORE LABELONLY   
FROM <backup_device>   
[ WITH   
 {  
--Media Set Options  
   MEDIANAME = { media_name | @media_name_variable }   
 | MEDIAPASSWORD = { mediapassword | @mediapassword_variable }  
  
--Error Management Options  
 | { CHECKSUM | NO_CHECKSUM }   
 | { STOP_ON_ERROR | CONTINUE_AFTER_ERROR }  
  
--Tape Options  
 | { REWIND | NOREWIND }   
 | { UNLOAD | NOUNLOAD }    
 } [ ,...n ]  
]  
[;]  
  
<backup_device> ::=  
{   
   { logical_backup_device_name |  
      @logical_backup_device_name_var }  
   | { DISK | TAPE | URL } = { 'physical_backup_device_name' |  
       @physical_backup_device_name_var }   
}  
  

Note

URL is the format used to specify the location and the file name for Microsoft Azure Blob Storage and is supported starting with [!INCLUDEssSQL11] SP1 CU2. Although Microsoft Azure storage is a service, the implementation is similar to disk and tape to allow for a consistent and seamless restore experience for all the three devices.

Arguments

For descriptions of the RESTORE LABELONLY arguments, see RESTORE Arguments (Transact-SQL).

Result Sets

The result set from RESTORE LABELONLY consists of a single row with this information.

Column name Data type Description
MediaName nvarchar(128) Name of the media.
MediaSetId uniqueidentifier Unique identification number of the media set.
FamilyCount int Number of media families in the media set.
FamilySequenceNumber int Sequence number of this family.
MediaFamilyId uniqueidentifier Unique identification number for the media family.
MediaSequenceNumber int Sequence number of this media in the media family.
MediaLabelPresent tinyint Whether the media description contains:

1 = [!INCLUDEmsCoName] Tape Format media label

0 = Media description
MediaDescription nvarchar(255) Media description, in free-form text, or the Tape Format media label.
SoftwareName nvarchar(128) Name of the backup software that wrote the label.
SoftwareVendorId int Unique vendor identification number of the software vendor that wrote the backup.
MediaDate datetime Date and time the label was written.
Mirror_Count int Number of mirrors in the set (1-4).

Note: The labels written for different mirrors in a set are identical.
IsCompressed bit Whether the backup is compressed:

0 = not compressed

1 =compressed

Note

If passwords are defined for the media set, RESTORE LABELONLY returns information only if the correct media password is specified in the MEDIAPASSWORD option of the command.

General Remarks

Executing RESTORE LABELONLY is a quick way to find out what the backup media contains. Because RESTORE LABELONLY reads only the media header, this statement finishes quickly even when using high-capacity tape devices.

Security

A backup operation may optionally specify passwords for a media set. When a password has been defined on a media set, you must specify the correct password in the RESTORE statement. The password prevents unauthorized restore operations and unauthorized appends of backup sets to media using [!INCLUDEmsCoName] [!INCLUDEssNoVersion] tools. However, a password does not prevent overwrite of media using the BACKUP statement's FORMAT option.

Important

The protection provided by this password is weak. It is intended to prevent an incorrect restore using [!INCLUDEssNoVersion] tools by authorized or unauthorized users. It does not prevent the reading of the backup data by other means or the replacement of the password. [!INCLUDEssNoteDepFutureAvoid]The best practice for protecting backups is to store backup tapes in a secure location or back up to disk files that are protected by adequate access control lists (ACLs). The ACLs should be set on the directory root under which backups are created.

Permissions

In [!INCLUDEssKatmai] and later versions, obtaining information about a backup set or backup device requires CREATE DATABASE permission. For more information, see GRANT Database Permissions (Transact-SQL).

See Also

BACKUP (Transact-SQL)
Media Sets, Media Families, and Backup Sets (SQL Server)
RESTORE REWINDONLY (Transact-SQL)
RESTORE VERIFYONLY (Transact-SQL)
RESTORE (Transact-SQL)
Backup History and Header Information (SQL Server)