Restore-AzSqlInstanceDatabase

Restores an Azure SQL Managed Instance database.

Syntax

Restore-AzSqlInstanceDatabase
       [-FromPointInTimeBackup]
       [-Name] <String>
       [-InstanceName] <String>
       [-ResourceGroupName] <String>
       -PointInTime <DateTime>
       -TargetInstanceDatabaseName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromPointInTimeBackup]
       [-InputObject] <AzureSqlManagedDatabaseModel>
       -PointInTime <DateTime>
       -TargetInstanceDatabaseName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromPointInTimeBackup]
       [-ResourceId] <String>
       -PointInTime <DateTime>
       -TargetInstanceDatabaseName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromPointInTimeBackup]
       [-Name] <String>
       [-InstanceName] <String>
       [-ResourceGroupName] <String>
       -PointInTime <DateTime>
       -TargetInstanceDatabaseName <String>
       -TargetInstanceName <String>
       -TargetResourceGroupName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromPointInTimeBackup]
       [-InputObject] <AzureSqlManagedDatabaseModel>
       -PointInTime <DateTime>
       -TargetInstanceDatabaseName <String>
       -TargetInstanceName <String>
       -TargetResourceGroupName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromPointInTimeBackup]
       [-ResourceId] <String>
       -PointInTime <DateTime>
       -TargetInstanceDatabaseName <String>
       -TargetInstanceName <String>
       -TargetResourceGroupName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromGeoBackup]
       [-GeoBackupObject] <AzureSqlRecoverableManagedDatabaseModel>
       -TargetInstanceDatabaseName <String>
       -TargetInstanceName <String>
       -TargetResourceGroupName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromGeoBackup]
       [-ResourceId] <String>
       -TargetInstanceDatabaseName <String>
       -TargetInstanceName <String>
       -TargetResourceGroupName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzSqlInstanceDatabase
       [-FromGeoBackup]
       [-Name] <String>
       [-InstanceName] <String>
       [-ResourceGroupName] <String>
       -TargetInstanceDatabaseName <String>
       -TargetInstanceName <String>
       -TargetResourceGroupName <String>
       [-AsJob]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

The Restore-AzSqlInstanceDatabase cmdlet restores an instance database from a geo-redundant backup or a point in time in a live database. The restored database is created as a new instance database.

Examples

Example 1: Restore an instance database from a point in time

PS C:\> Restore-AzSqlinstanceDatabase -Name "Database01" -InstanceName "managedInstance1" -ResourceGroupName "ResourceGroup01" -PointInTime UTCDateTime -TargetInstanceDatabaseName "Database01_restored"

The command restores the instance database Database01 from the specified point-in-time backup to the instance database named Database01_restored.

Example 2: Restore an instance database from a point in time to another instance on different resource group

PS C:\> Restore-AzSqlInstanceDatabase -Name "Database01" -InstanceName "managedInstance1" -ResourceGroupName "ResourceGroup01" -PointInTime UTCDateTime -TargetInstanceDatabaseName "Database01_restored" -TargetInstanceName "managedInstance1" -TargetResourceGroupName "ResourceGroup02"

The command restores the instance database Database01 on instance managedInstance1 on resource group ResourceGroup01 from the specified point-in-time backup to the instance database named Database01_restored on instance managedInstance2 on resource group ResourceGroup02.

Example 3: Geo-Restore an instance database

PS C:\>$GeoBackup = Get-AzSqlInstanceDatabaseGeoBackup -ResourceGroupName "ResourceGroup01" -InstanceName "managedInstance1" -Name "Database01"
PS C:\> $GeoBackup | Restore-AzSqlInstanceDatabase -FromGeoBackup -TargetInstanceDatabaseName "Database01_restored" -TargetInstanceName "managedInstance2" -TargetResourceGroupName "ResourceGroup02"

The first command gets the geo-redundant backup for the database named Database01, and then stores it in the $GeoBackup variable. The second command restores the backup in $GeoBackup to the instance database named Database01_restored.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-FromGeoBackup

Restore from a geo backup.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-FromPointInTimeBackup

Restore from a point-in-time backup.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-GeoBackupObject

The recoverable instance database object to restore

Type:Microsoft.Azure.Commands.Sql.ManagedDatabase.Model.AzureSqlRecoverableManagedDatabaseModel
Aliases:RecoverableInstanceDatabase
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-InputObject

The Instance Database object to restore

Type:Microsoft.Azure.Commands.Sql.ManagedDatabase.Model.AzureSqlManagedDatabaseModel
Aliases:InstanceDatabase
Position:0
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-InstanceName

The instance name.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

The instance database name to restore.

Type:String
Aliases:InstanceDatabaseName
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PointInTime

The point in time to restore the database to.

Type:DateTime
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

The name of the resource group.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceId

The resource id of Instance Database object to restore

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TargetInstanceDatabaseName

The name of the target instance database to restore to.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TargetInstanceName

The name of the target instance to restore to. If not specified, the target instance is the same as the source instance.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TargetResourceGroupName

The name of the target resource group to restore to. If not specified, the target resource group is the same as the source resource group.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Azure.Commands.Sql.ManagedDatabase.Model.AzureSqlManagedDatabaseModel

Microsoft.Azure.Commands.Sql.ManagedDatabase.Model.AzureSqlRecoverableManagedDatabaseModel

String

Outputs

Microsoft.Azure.Commands.Sql.ManagedDatabase.Model.AzureSqlManagedDatabaseModel