TechNet
Export (0) Print
Expand All

managed_backup.fn_available_backups (Transact-SQL)

 

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2016)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Returns a table of 0, one or more rows of the available backup files for the specified database. The backup files returned are backups created by SQL Server Managed Backup to Microsoft Azure.

Applies to: SQL Server (SQL Server 2016 through current version).

Topic link icon Transact-SQL Syntax Conventions

managed_backup.fn_available_backups ([@database_name = ] 'database name')  

@database_name
The name of the database. The @database_name is NVARCHAR(512).

The table has a unique clustered constraint on (database_guid, backup_start_date, and first_lsn, backup_type).
If a database is dropped and then recreated, the backup sets for all the databases are returned. The output is ordered by the database_guid, which uniquely identified each database.
If there are gaps in LSN meaning that there is a break in the log chain, the table will contain a special row for each missing LSN segment.

Column nameData typeDescription
Backup_pathNVARCHAR(260) COLLATE Latin1_General_CI_AS_KS_WSThe URL of the backup file.
backup_typeNVARCHAR(6)‘DB’ for database backup ‘LOG’ for log backup
expiration_dateDATETIMEThe date on which this file is expected to be deleted. This is set based on the ability to recover the database to a point in time within the specified retention period.
database_guidUNIQUEIDENTIFIERThe GUID value for the specified database. The GUID uniquely identifies a database.
first_lsnNUMERIC(25, 0)Log sequence number of the first or oldest log record in the backup set. Can be NULL.
last_lsnNUMERIC(25, 0)Log sequence number of the next log record after the backup set. Can be NULL.
backup_start_dateDATETIMEDate and time the backup operation started.
backup_finish_dateNVARCHAR(128)Date and time the backup operation finished.
machine_nameNVARCHAR(128)Name of the computer where the SQL Server instance is installed and running SQL Server Managed Backup to Microsoft Azure.
last_recovery_fork_idUNIQUEIDENTIFIERIdentification number for the ending recovery fork.
first_recovery_fork_idUNIQUEIDENTIFIERID of the starting recovery fork. For data backups, first_recovery_fork_guid equals last_recovery_fork_guid.
fork_point_lsnNUMERIC(25, 0)If first_recovery_fork_id is not equal to last_recovery_fork_id, this is the log sequence number of the fork point. Otherwise, this value is NULL.
availability_group_guidUNIQUEIDENTIFIERIf a database is an Always On database, this is the GUID of the availability group. Otherwise this value is NULL.

0 (success) or 1 (failure).

Permissions

Requires SELECT permissions on this function.

The following example lists all the available backups backed up through SQL Server Managed Backup to Microsoft Azure for the database ‘MyDB’

SELECT *   
FROM managed_backup.fn_available_backups ('MyDB')  
  

SQL Server Managed Backup to Microsoft Azure
Restoring From Backups Stored in Microsoft Azure

Community Additions

ADD
Show:
© 2016 Microsoft