Create Database Recovery Request (classic)
THIS TOPIC APPLIES TO: SQL Server Azure SQL DatabaseAzure SQL Data Warehouse Parallel Data Warehouse
Recover an Azure SQL Database.
Important
The recommended REST commands to work with SQL Database are the Resource Manager based Azure SQL Database REST API. While there is no change to SQL Database, be aware that the classic deployment model command in this article is scheduled for deprecation on December 1, 2019. For a table providing links to the specific new commands you should use, see Operations for Azure SQL Databases.
Request
The Create Database Recovery Request must be specified as follows:
Replace {subscriptionId} with your subscription ID.
Replace {sourceServerName} with the server name where the recoverable database is located.
Method | Request URI | HTTP Version |
---|---|---|
POST | https://management.core.windows.net:8443/{subscriptionId}/servers/{sourceServerName}/recoverdatabaseoperations | HTTP/1.1 |
The time to recover a database will vary depending on the size and attributes of the specific database. Use Database Operation Status (classic) to check the status of a recovery operation.
URI Parameters
None.
Request Headers
The following table describes the required and optional request headers:
Request Header | Description |
---|---|
x-ms-version | Required. Specifies the version of the operation to use for this request. This header should be set to 2012-03-01. |
x-ms-client-request-id | Optional. Provides a client-generated, opaque value with a 1 KB character limit. Using this header is highly recommended for correlating client-side activities with requests received by the server. |
Request Body
The format of the request body is as follows:
<ServiceResource xmlns="https://schemas.microsoft.com/windowsazure">
<SourceDatabaseName>sourceDB</SourceDatabaseName>
<TargetServerName>targetServer</TargetServerName>
<TargetDatabaseName>targetDB</TargetDatabaseName>
</ServiceResource>
The following table describes the elements of the request body:
Element Name | Description |
---|---|
SourceDatabaseName | The name of the database to recover. |
TargetServerName | The name of the server to recover the database to. |
TargetDatabaseName | The name of the database to recover to. |
Note
The TargetDatabaseName must not be the name of a live database already on the server. The {sourceDatabaseName} and {targetDatabaseName} should not use system reserved names, such as master, tempdb, model, msdb, for example.
Response
The response includes an HTTP status code, a set of response headers, and a response body.
Status Code
Response status code 201 (Created) indicates the request succeeded.
Response Headers
The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
Response Header | Description |
---|---|
x-ms-request-id | A value that uniquely identifies a request made against the database management service. This request id is used for request tracking. If a failure occurs that requires the user to contact Microsoft Support, the request id should be provided to Microsoft to assist in tracking and resolving the failure for the request. |
Response Body
The following is an example response body:
<ServiceResource xmlns="https://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name i:nil="true" />
<Type>Microsoft.SqlAzure.RecoverDatabaseOperation</Type>
<State>Created</State>
<SelfLink i:nil="true" />
<ParentLink i:nil="true" />
<RequestID>a6966e0d-4e27-47d9-85f6-c5a9c1cc2264</RequestID>
<SourceDatabaseName>recoverableDBName</SourceDatabaseName>
<TargetServerName>servername</TargetServerName>
<TargetDatabaseName>RecoveredDBName</TargetDatabaseName>
</ServiceResource>
The following table describes the elements in the response body:
Element Name | Description |
---|---|
SourceDatabaseName | The name of the database being recovered. |
TargetServerName | The name of the server where the database will be recovered to. |
TargetDatabaseName | The name for the recovered database. |
Remarks
To check if a specific database is available for recovery, see Get Recoverable Database (classic). For a complete list of databases that can be recovered, see List Recoverable Databases (classic).
See Also
Recover an Azure SQL database using Geo-Restore with REST API
Common REST API Error Codes
Azure SQL Database
Operations for Azure SQL Databases
Azure SQL Database Cmdlets
Start-AzureSqlDatabaseRecovery