Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Start-AzureSqlDatabaseRestore

Start-AzureSqlDatabaseRestore

microsoft.windowsazure.commands.sqldatabase.dll

Synopsis

Submits a restore request for a live or dropped database.

Syntax

Start-AzureSqlDatabaseRestore [-SourceServerName] [-SourceDatabaseName] [-SourceDatabaseDeletionDate] [-TargetServerName] [-RestorableDropped] [-TargetDatabaseName] [-PointInTime] [<CommonParameters>]

Start-AzureSqlDatabaseRestore [-SourceServerName] [-SourceDatabaseName] [-TargetServerName] [-TargetDatabaseName] [-PointInTime] [<CommonParameters>]

Start-AzureSqlDatabaseRestore [-SourceServerName] [-SourceDatabase] [-TargetServerName] [-TargetDatabaseName] [-PointInTime] [<CommonParameters>]

Start-AzureSqlDatabaseRestore [-SourceServerName] [-SourceRestorableDroppedDatabase] [-TargetServerName] [-TargetDatabaseName] [-PointInTime] [<CommonParameters>]

Detailed Description

Use this cmdlet to do a point in time restore of a Standard or Premium database. For standard databases, the backups are retained for 7 days and for Premium databases, the backups are retained up to 35 days. The restore operation creates a new database. If you are restoring to the same server as the source database, you must specific a different name from the source database. NOTE: For this release, the source server name and the target server name should be the same.

Parameters

-SourceServerName <String>

The name of the server where the source database is live and running, or the name of the server where the source database was running before it was deleted.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-SourceDatabaseName <String>

The name of the live database you want to restore

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-SourceDatabaseDeletionDate <DateTime>

The date and time when the database was deleted. You must include milliseconds when specifying the time to match the actual database deletion time.

Aliases

None

Required?

true

Position

2

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-TargetServerName <String>

The name of the server that you want to restore the database to. This can be the same server as the source database or a different server.NOTE: For this release, the source server name and the target server name should be the same.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-RestorableDropped <SwitchParameter>

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-TargetDatabaseName <String>

The name of the new database that will be created as a result of the restore operation.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-PointInTime <Nullable`1[DateTime]>

The restore point for the database to be restored to. When the restore operation has completed, the database is restored to the state it was at the specific date and time specified using this parameter. By default, for a live database this set to the current time, and for a dropped database, it is set to the time when the database was dropped.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-SourceDatabase <Database>

A single object that represents the live database that you want to restore.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

-SourceRestorableDroppedDatabase <RestorableDroppedDatabase>

The database object that represents a recoverable dropped database. You can get this object using the Get-AzureSqlDatabase cmdlet using –RestorableDropped switch parameter.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

Input Type

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

Return Type

Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.RestoreDatabaseOperation

Notes

You must use certificate based authentication to run this cmdlet. The following commands need to be run on the machine you are using to run the cmdlet: C:\PS>$subId = <Subscription ID> C:\PS>$thumbprint = <Certificate Thumbprint> C:\PS>$myCert = Get-Item Cert:\CurrentUser\My\$thumbprint C:\PS>Set-AzureSubscription -SubscriptionName "mySubscription" -SubscriptionId $subId -Certificate $myCert C:\PS>Select-AzureSubscription -SubscriptionName "mySubscription"

Examples

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

This example lists the databases on the server, then stores a specific database object in a variable, and restores the database to a specific point in time.

PS C:\>$mydb = Get-AzureSqlDatabase -ServerName "a234b56" -DatabaseName "mydatabase" # Restore the database using database object PS C:\>$operation = Start-AzureSqlDatabaseRestore -SourceDatabase $mydb -TargetDatabaseName "mydatabaserestored" -PointInTime "2013-01-01 06:00:00"

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

This example lists the databases on the server, specifies the database properties for a database and restores the database to a specific point in time.

PS C:\>$operation = Start-AzureSqlDatabaseRestore -SourceServerName "a234b56" -SourceDatabaseName "mydatabase" -TargetDatabaseName "mydatabaserestored" -PointInTime "2013-01-01 06:00:00"

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

This example restores a dropped database.

PS C:\>$mydb = Get-AzureSqlDatabase -RestorableDropped -ServerName "server1" -DatabaseName "mydb" -DatabaseDeletionDate "2013-01-01 06:00:00"# Restore the dropped database using database object PS C:\>$operation = Start-AzureSqlDatabaseRestore -SourceRestorableDroppedDatabase $mydb -TargetDatabaseName "mydroppeddatabaserestored"

Online Version