Redigera

Dela via


Restore-AzMySqlServer

Restore a server from an existing backup

Syntax

Restore-AzMySqlServer
       -Name <String>
       -ResourceGroupName <String>
       [-SubscriptionId <String>]
       -InputObject <IServer>
       [-UseGeoRestore]
       [-Location <String>]
       [-Sku <String>]
       [-Tag <Hashtable>]
       [-DefaultProfile <PSObject>]
       [-AsJob]
       [-NoWait]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzMySqlServer
       -Name <String>
       -ResourceGroupName <String>
       [-SubscriptionId <String>]
       -InputObject <IServer>
       [-Location <String>]
       [-Sku <String>]
       [-Tag <Hashtable>]
       -RestorePointInTime <DateTime>
       [-UsePointInTimeRestore]
       [-DefaultProfile <PSObject>]
       [-AsJob]
       [-NoWait]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

Restore a server from an existing backup

Examples

Example 1: Restore MySql server using GeoReplica Restore

Get-AzMySqlServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test-replica | Restore-AzMySqlServer -Name mysql-test -ResourceGroupName PowershellMySqlTest -UseGeoRestore

Name          Location AdministratorLogin Version StorageProfileStorageMb SkuName   SkuTier        SslEnforcement
----          -------- ------------------ ------- ----------------------- -------   -------        --------------
mysql-test-11 eastus   mysql_test         5.7     10240                   GP_Gen5_4 GeneralPurpose Disabled

This cmdlet restores MySql server using GeoReplica Restore.

Example 2: Restore MySql server using PointInTime Restore

$restorePointInTime = (Get-Date).AddMinutes(-10)
Get-AzMySqlServer -ResourceGroupName PowershellMySqlTest -ServerName mysql-test | Restore-AzMySqlServer -Name mysql-test-restore -ResourceGroupName PowershellMySqlTest -RestorePointInTime $restorePointInTime -UsePointInTimeRestore

Name               Location AdministratorLogin Version StorageProfileStorageMb SkuName   SkuTier        SslEnforcement
----               -------- ------------------ ------- ----------------------- -------   -------        --------------
mysql-test-restore eastus   mysql_test         5.7     10240                   GP_Gen5_4 GeneralPurpose Disabled

These cmdlets restore MySql server using PointInTime Restore.

Parameters

-AsJob

Run the command as a job.

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:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

The source server object to restore from. To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

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

-Location

The location the resource resides in.

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

-Name

The name of the server.

Type:String
Aliases:ServerName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-NoWait

Run the command asynchronously.

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

-ResourceGroupName

The name of the resource group that contains the resource, You can obtain this value from the Azure Resource Manager API or the portal.

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

-RestorePointInTime

The location the resource resides in.

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

-Sku

The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.

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

-SubscriptionId

The subscription ID that identifies an Azure subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Application-specific metadata in the form of key-value pairs.

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

-UseGeoRestore

Use Geo mode to restore

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

-UsePointInTimeRestore

Use PointInTime mode to restore

Type:SwitchParameter
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

IServer

Outputs

IServer