Restore-AzureRmSqlInstanceDatabase

Restores an Azure SQL Managed Instance database.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

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

Description

The Restore-AzureRmSqlInstanceDatabase cmdlet restores an instance database from a point in time in a live database. The restored database is created as a new instance database.

Examples

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

PS C:\> Restore-AzureRmSqlinstanceDatabase -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 a instance database from a point in time to another instance on different resource group

PS C:\> Restore-AzureRmSqlInstanceDatabase -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.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FromPointInTimeBackup

Restore from a point-in-time backup.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

The Instance Database object to restore

Type:AzureSqlManagedDatabaseModel
Aliases:InstanceDatabase
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-InstanceName

The instance name.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

The instance database name to restore.

Type:String
Aliases:InstanceDatabaseName
Position:0
Default value:None
Required:True
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
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

Type:String
Position:2
Default value:None
Required:True
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
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TargetInstanceDatabaseName

The name of the target instance database to restore to.

Type:String
Position:Named
Default value:None
Required:True
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
Required:True
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
Required:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

AzureSqlManagedDatabaseModel

System.String

Outputs

AzureSqlManagedDatabaseModel