Database Operation Status (classic)


THIS TOPIC APPLIES TO: noSQL Server yesAzure SQL DatabaseyesAzure SQL Data Warehouse noParallel Data Warehouse

Gets the status of a specific operation on a database, all the operations (history) on a database, or all the operations on all databases on a server.

This functionality is equivalent to querying the sys.dm_operation_status table.


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.


The Database Operation Status request must be specified as follows:

  • Replace {subscriptionId} with your subscription ID.

  • Replace {serverName} with the name of the server containing the database whose operation you want to query.

  • Replace {operationGuid} with the unique identifier (Guid) for the operation.

  • Replace {databaseName} with a database name to get the history of all operations on that database.

Method Request URI HTTP Version
GET{subscriptionId}/services/sqlservers/servers/{serverName}/databaseoperations/{operationGuid} HTTP/1.1
GET{subscriptionId}/services/sqlservers/servers/{serverName}/databaseoperations?databaseName={databaseName} HTTP/1.1
GET{subscriptionId}/services/sqlservers/servers/{serverName}/databaseoperations?contentview=generic HTTP/1.1

The third form lists all operations on all databases on a server.

URI Parameters


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.

Request Body



The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

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 for the history of all operations on a database.

The response to get database operations by {operationGuid} will only have one <ServiceResource> entity instead of 3.

The response to get database operations for all databases on the server will have a <ServiceResource> entity for each database operation that took place on any database on the server.

<ServiceResources xmlns="" xmlns:i="">  
    <Name>ALTER DATABASE</Name>  
    <Name>ALTER DATABASE</Name>  
    <Error>The edition 'Web' does not support the database max size '2 GB'.</Error>  

The following is an example response for a database restore request.

<ServiceResources xmlns="" xmlns:i="">  
    <Name>DATABASE RESTORE</Name>  
    <Error />  

The following table describes the elements in the response body:

Element Name Description
Name The name of the operation.
Type The type of the service resource; Microsoft.SqlAzure.DatabaseOperation.
State The state of the database operation.
SelfLink The URI identifier for this resource.
ParentLink The URI identifier for the parent of this resource (the server).
Id The identifier for this resource.
StateId The identifier for the state of this resource.
SessionActivityId The identifier for the session activity.
DatabaseName The name of the database.
PercentComplete The percent complete for this operation.
ErrorCode Specifies an error code if an error occurs.
Error Specifies a description of the error if an error occurs.
ErrorSeverity Specifies the error severity level if an error occurs.
ErrorState Specifies the state of the error if an error occurs.
StartTime Specifies the start time of the operation.
LastModifyTime Specifies the last modify time of the operation.

See Also

Recover an Azure SQL database using Geo-Restore with REST API
Restore an Azure SQL database using Point in Time Restore with REST API
Restore a deleted Azure SQL database with REST API
Common REST API Error Codes
Operations for Azure SQL Databases
Azure SQL Database
Azure SQL Database Cmdlets