你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Restore-AzMySqlServer

从现有备份还原服务器

语法

GeoRestore (默认值)

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

PointInTimeRestore

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

说明

从现有备份还原服务器

示例

示例 1:使用 GeoReplica Restore 还原 MySql 服务器

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

此 cmdlet 使用 GeoReplica Restore 还原 MySql 服务器。

示例 2:使用 PointInTime 还原还原 MySql 服务器

$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

这些 cmdlet 使用 PointInTime 还原还原 MySql 服务器。

参数

-AsJob

以作业身份运行命令。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Confirm

在运行 cmdlet 之前,提示你进行确认。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DefaultProfile

用于与 Azure 通信的凭据、帐户、租户和订阅。

参数属性

类型:PSObject
默认值:None
支持通配符:False
不显示:False
别名:AzureRMContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-InputObject

要从中还原的源服务器对象。 若要构造,请参阅 INPUTOBJECT 属性的 NOTES 部分并创建哈希表。

参数属性

类型:IServer
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Location

资源所在的位置。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Name

服务器的名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False
别名:服务器名称

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-NoWait

异步运行命令。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-ResourceGroupName

包含资源的资源组的名称,可以从 Azure 资源管理器 API 或门户获取此值。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-RestorePointInTime

资源所在的位置。

参数属性

类型:DateTime
默认值:None
支持通配符:False
不显示:False

参数集

PointInTimeRestore
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Sku

sku 的名称(通常为层 + 系列 + 核心),例如B_Gen4_1,GP_Gen5_8。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-SubscriptionId

标识 Azure 订阅的订阅 ID。

参数属性

类型:String
默认值:(Get-AzContext).Subscription.Id
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Tag

键值对形式的应用程序特定元数据。

参数属性

类型:Hashtable
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-UseGeoRestore

使用异地模式还原

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

GeoRestore
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-UsePointInTimeRestore

使用 PointInTime 模式还原

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

PointInTimeRestore
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

显示 cmdlet 运行时会发生什么情况。 命令脚本未运行。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False
别名:无线

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

IServer

输出

IServer