VERKOOP: 1-800-867-1389
EN
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

Get-AzureSqlDatabase

Get-AzureSqlDatabase

Returns one or more Azure SQL Database.

Syntax

Parameter Set: ByConnectionContext
Get-AzureSqlDatabase [-ConnectionContext] <IServerDataServiceContext> [-Database <Database> ] [-DatabaseDeletionDate <DateTime> ] [-DatabaseName <String> ] [-RestorableDropped] [-RestorableDroppedDatabase <RestorableDroppedDatabase> ] [ <CommonParameters>]

Parameter Set: ByServerName
Get-AzureSqlDatabase [-ServerName] <String> [-Database <Database> ] [-DatabaseDeletionDate <DateTime> ] [-DatabaseName <String> ] [-RestorableDropped] [-RestorableDroppedDatabase <RestorableDroppedDatabase> ] [ <CommonParameters>]




Detailed Description

Use this cmdlet to retrieve one or more Azure SQL Database from an Azure SQL Database Server. You can specify the server with a SQL Database Server connection context that you create using the New-AzureSqlDatabaseServerContext cmdlet. Or, if you specify the SQL Database Server name, the cmdlet uses the current Azure subscription information to authenticate the request to access the server.

If a database is not specified, the Get-AzureSqlDatabase cmdlet returns all databases from the specified server.

Retrieving restorable dropped databases:

Retrieve restorable dropped databases by using the RestorableDropped parameter. To return all restorable dropped databases use the RestorableDropped parameter without DatabaseName and DatabaseDeletionDate. To return a specific restorable dropped database use the RestorableDropped parameter with the DatabaseName and DatabaseDeletionDate parameters. When retrieving a specific restorable dropped database by using the DatabaseName parameter you must also include the DatabaseDeletionDate parameter (and the specified DatabaseDeletionDate value must include milliseconds to match the desired database).

The Get-AzureSqlDatabase cmdlet returns either all restorable dropped databases on a server, or one specific database that matches both DatabaseName and DatabaseDeletionDate. To return restorable dropped databases that satisfy a different criteria, such as all restorable dropped databases of a specific name, you must return all restorable dropped databases, and then filter the results on the client.

Parameters

-ConnectionContext<IServerDataServiceContext>

The connection context to an Azure SQL Database Server from which to retrieve an Azure SQL Database.


Aliases

Context

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-Database<Database>

A database object representing the database to be retrieved.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-DatabaseDeletionDate<DateTime>

If the RestorableDropped parameter is specified, then you can use this parameter to retrieve a restorable dropped database based on the deletion date and time.

Note: The DatabaseDeletionDate parameter must include milliseconds to successfully match the time and find the desired database. Specifying a value without including milliseconds will result in the database not being found.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DatabaseName<String>

The name of the database to be retrieved.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RestorableDropped

If specified, the Get-AzureSqlDatabase cmdlet returns RestorableDroppedDatabase objects instead of Database objects, and the DatabaseDeletionDate parameter may be used to select a specific restorable dropped database.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RestorableDroppedDatabase<RestorableDroppedDatabase>

The object representing the restorable dropped database to retrieve.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-ServerName<String>

The name of the server containing the database to be retrieved. The cmdlet uses the current Azure subscription to access the server.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database
  • Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.RestorableDroppedDatabase

Outputs

The output type is the type of the objects that the cmdlet emits.

  • IEnumerable<Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database>

    Returns a Database object if the RestorableDropped parameter is not specified.


  • IEnumerable<Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.RestorableDroppedDatabase>

    Returns a RestorableDroppedDatabase object if the RestorableDropped parameter is specified.


Examples

-------------------------- EXAMPLE 1 --------------------------

This example returns all databases on server, "lpqd0zbr8y".


C:\PS>Get-AzureSqlDatabase -ServerName "lpqd0zbr8y"

-------------------------- EXAMPLE 2 --------------------------

This example returns all restorable dropped databases on server, "lpqd0zbr8y".


C:\PS>Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" -RestorableDropped

-------------------------- EXAMPLE 3 --------------------------

This example returns database, "Database1", from the server specified by the connection context “$ctx”.


C:\PS>$database1 = Get-AzureSqlDatabase -ConnectionContext $ctx -DatabaseName "Database1"

-------------------------- EXAMPLE 4 --------------------------

This example returns database, "Database1", from server, "lpqd0zbr8y".


C:\PS>$database1 = Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" -DatabaseName "Database1"

-------------------------- EXAMPLE 5 --------------------------

This example returns the restorable dropped database, "Database1", that was deleted on 11/9/2012 from SQL Database Server, "lpqd0zbr8y".


C:\PS>$droppedDB = Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" -DatabaseName "Database1" -DatabaseDeletionDate "2012-11-09T22:59:43.000Z" -RestorableDropped

-------------------------- EXAMPLE 6 --------------------------

This example returns all restorable dropped databases on server "lpqd0zbr8y", and then filters the results to only the databases named "ContactDB".


C:\PS>Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" –RestorableDropped | Where-Object {$_.Name –eq "ContactDB"}

Related topics

Vindt u dit nuttig?
(1500 tekens resterend)
Bedankt voor uw feedback
Weergeven:
© 2015 Microsoft