Get Database (classic)

 

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

Gets the details for 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 Get Database request must be specified as follows:

  • Replace {subscriptionId} with your subscription ID.

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

  • Replace {databaseName} with the name of the database you want to inspect.

Method Request URI HTTP Version
GET https://management.core.windows.net:8443/{subscriptionId}/services/sqlservers/servers/{serverName}/databases/{databaseName} HTTP/1.1

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.

Request Body

None.

Response

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 body:

<ServiceResource xmlns="https://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">  
  <Name>MyDatabase</Name>  
  <Type>Microsoft.SqlAzure.Database</Type>  
  <State>Normal</State>  
  <SelfLink>http://asdf/servers/xbi75mhqni/databases/MyWebDatabase</SelfLink>  
  <ParentLink>http://asdf/servers/xbi75mhqni</ParentLink>  
  <Id>4</Id>  
  <Edition>Basic</Edition>  
  <MaxSizeGB>1</MaxSizeGB>  
  <CollationName>SQL_Latin1_General_CP1_CI_AS</CollationName>  
  <CreationDate>2014-04-16T01:56:00.3600000Z</CreationDate>  
  <IsFederationRoot>False</IsFederationRoot>  
  <IsSystemObject>False</IsSystemObject>  
  <SizeMB i:nil="true"/>  
  <MaxSizeBytes>1073741824</MaxSizeBytes>  
  <ServiceObjectiveId>dd6d99bb-f193-4ec1-86f2-43d3bccbc49c</ServiceObjectiveId>  
  <AssignedServiceObjectiveId>dd6d99bb-f193-4ec1-86f2-43d3bccbc49c</AssignedServiceObjectiveId>  
  <ServiceObjectiveAssignmentState>1</ServiceObjectiveAssignmentState>  
  <ServiceObjectiveAssignmentStateDescription>Complete</ServiceObjectiveAssignmentStateDescription>  
  <ServiceObjectiveAssignmentErrorCode>0</ServiceObjectiveAssignmentErrorCode>  
  <ServiceObjectiveAssignmentErrorDescription i:nil="true"/>  
  <ServiceObjectiveAssignmentSuccessDate>2014-04-16T01:56:48.2400000Z</ServiceObjectiveAssignmentSuccessDate>  
  <RecoveryPeriodStartDate i:nil="true"/>  
</ServiceResource>  

The following table describes the elements of the response body:

Name The name of the database to retrieve.
Type The type of the resource. A database will be Microsoft.SqlAzure.Database.
State The state of the service resource.
SelfLink The URI for this service resource.
ParentLink The URI for the parent service resource.
Id The database ID. Each database in a server has a unique ID.
Edition The current edition of the database. If the edition was changed during an update, this will be the old value until any pending Service Level Objective (SLO) assignments are completed. For edition changes that don’t require a SLO change, this will be the new edition.
MaxSizeGB The maximum size of the database in gigabytes.
CollationName The name of the database collation.
CreationDate The date and time this database was created.
IsFederationRoot Specifies if this database is the federation root.
IsSystemObject Specifies if this database is a system object. Master database is an example of a system object.
SizeMb The currently used size of the database in megabytes.
MaxSizeBytes The maximum size of the database expressed in bytes.
ServiceObjectiveId The currently assigned and active service objective ID. If a SLO change is in progress or pending, this will be the SLO before the update was applied.

To know which GUID to use in ServiceObjectiveId, see List Service Level Objectives (classic) find the ID of the service that you want, and locate the GUID for that service.
AssignedServiceObjectiveId The currently assigned service objective ID. If a SLO change is in progress or pending this will be the new SLO that is assigned to the database.
ServiceObjectiveAssignmentState An integer representing the current state of the service objective assignment operation. 1 is complete and 0 is pending.
ServiceObjectiveAssignementStateDescription The current state of the service objective assignment. Pending means the database is currently transitioning from one Service Objective to another. Complete means that the service objective assignment completed successfully.
ServiceObjectiveAssignmentErrorCode If there was an error assigning the service objective to the database, this will contain the error code.
ServiceObjectiveAssignmentErrorDescription The description for the error, if there was an error.
ServiceObjectiveAssignmentSuccessDate The date and time that the service objective was successfully applied to the database.
RecoveryPeriodStartDate The starting date for when database recovery is available.

See Also

Restore an Azure SQL database using Point in Time Restore with REST API
Common REST API Error Codes
Azure SQL Database
Operations for Azure SQL Databases
Azure SQL Database Cmdlets
Get-AzureSqlDatabase