Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 2.97 KB

File metadata and controls

74 lines (55 loc) · 2.97 KB
title managed_backup.sp_backup_on_demand (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 06/10/2016
ms.prod sql
ms.prod_service database-engine
ms.reviewer
ms.technology system-objects
ms.topic language-reference
f1_keywords
smart_admin.sp_backup_on_demand
smart_admin.sp_backup_on_demand_TSQL
sp_backup_on_demand_TSQL
sp_backup_on_demand
dev_langs
TSQL
helpviewer_keywords
smart_admin.sp_backup_on_demand
sp_backup_on_demand
ms.assetid 638f809f-27fa-4c44-a549-9cf37ecc920c
author MikeRayMSFT
ms.author mikeray

managed_backup.sp_backup_on_demand (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2016-xxxx-xxxx-xxx-md]

Requests [!INCLUDEss_smartbackup] to perform a backup of the specified database.

Use this stored procedure to perform ad hoc backups for a database configured with [!INCLUDEss_smartbackup]. This prevents any break in the backup chain and [!INCLUDEss_smartbackup] processes are aware and the backup is stored in the same Azure Blob storage container.

Upon successful completion of the backup the full backup file path is returned. This includes the name and location of the new backup file resulting from the backup operation.

An error is returned if [!INCLUDEss_smartbackup] is in the process of executing a backup of given type for the specified database. In this case, the error message returned includes the full backup file path where the current backup is being uploaded to.

Topic link icon Transact-SQL Syntax Conventions

Syntax

EXEC managed_backup.sp_backup_on_demand   
[@database_name  =]  'database name',[@type = ] { 'Database' | 'Log' }  
  

Arguments

@database_name
The name of the database on which the backup is to be performed. The @database_name is SYSNAME.

@type
The type of backup to be performed: Database or Log. The @type parameter is NVARCHAR(32).

Return Code Value

0 (success) or 1 (failure)

Security

Permissions

Requires membership in db_backupoperator database role, with ALTER ANY CREDENTIAL permissions, and EXECUTE permissions on sp_delete_backuphistorystored procedure.

Examples

The following example makes a database backup request for the database 'TestDB'. This database has [!INCLUDEss_smartbackup] enabled.

Use MSDB  
Go  
EXEC managed_backup.sp_backup_on_demand  
 @database_name = 'TestDB'  
,@type = 'Database'  
  

For each code snippet, select 'tsql' in the language attribute field.