你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Set-AzureSqlDatabase
设置Azure SQL 数据库的属性。
注意
本文档中引用的 cmdlet 用于管理使用 Azure Service Manager (ASM) API 的旧式 Azure 资源。 创建新资源时,建议不要使用旧的 PowerShell 模块,因为计划将停用 ASM。 有关详细信息,请参阅 Azure Service Manager 停用。
Az PowerShell 模块是建议用于管理 PowerShell 的 Azure 资源管理器 (ARM) 资源的 PowerShell 模块。
语法
Set-AzureSqlDatabase
-ConnectionContext <IServerDataServiceContext>
-DatabaseName <String>
[-NewDatabaseName <String>]
[-Edition <DatabaseEdition>]
[-MaxSizeGB <Int32>]
[-MaxSizeBytes <Int64>]
[-ServiceObjective <ServiceObjective>]
[-PassThru]
[-Force]
[-Sync]
[-Profile <AzureSMProfile>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzureSqlDatabase
-ConnectionContext <IServerDataServiceContext>
-Database <Database>
[-NewDatabaseName <String>]
[-Edition <DatabaseEdition>]
[-MaxSizeGB <Int32>]
[-MaxSizeBytes <Int64>]
[-ServiceObjective <ServiceObjective>]
[-PassThru]
[-Force]
[-Sync]
[-Profile <AzureSMProfile>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzureSqlDatabase
-ServerName <String>
-DatabaseName <String>
[-NewDatabaseName <String>]
[-Edition <DatabaseEdition>]
[-MaxSizeGB <Int32>]
[-MaxSizeBytes <Int64>]
[-ServiceObjective <ServiceObjective>]
[-PassThru]
[-Force]
[-Sync]
[-Profile <AzureSMProfile>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzureSqlDatabase
-ServerName <String>
-Database <Database>
[-NewDatabaseName <String>]
[-Edition <DatabaseEdition>]
[-MaxSizeGB <Int32>]
[-MaxSizeBytes <Int64>]
[-ServiceObjective <ServiceObjective>]
[-PassThru]
[-Force]
[-Sync]
[-Profile <AzureSMProfile>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Set-AzureSqlDatabase cmdlet 设置Azure SQL 数据库的属性。 可以按名称指定数据库,也可以通过管道传递Azure SQL 数据库对象。 可以按名称指定服务器,也可以传递Azure SQL 数据库服务器连接上下文。 通过运行 New-AzureSqlDatabaseServerContext cmdlet 创建连接上下文。 如果按名称指定服务器,cmdlet 将使用当前的 Azure 订阅信息对请求进行身份验证。
示例
示例 1:使用连接上下文更改数据库的大小
PS C:\> $Database01 = Get-AzureSqlDatabase -ConnectionContext $Context -DatabaseName "Database01"
PS C:\> Set-AzureSqlDatabase -ConnectionContext $Context -Database $Database01 -MaxSizeGB 20
此示例将名为 Database01 的数据库的大小更改为 20 GB,Azure SQL 数据库服务器连接上下文$Context。
示例 2:使用服务器名称更改数据库的大小
PS C:\> $Database01 = Get-AzureSqlDatabase -ServerName "lpqd0zbr8y" -DatabaseName "Database01"
PS C:\> Set-AzureSqlDatabase -ServerName "lpqd0zbr8y" -Database $Database01 -MaxSizeGB 20
此示例将名为 Database01 的数据库的大小更改为 lpqd0zbr8y 服务器中的 20 GB。
参数
-Confirm
提示你在运行 cmdlet 之前进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ConnectionContext
指定服务器的连接上下文。
类型: | IServerDataServiceContext |
别名: | Context |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-Database
指定一个对象,该对象表示此 cmdlet 修改的Azure SQL 数据库。
类型: | Database |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-DatabaseName
指定此 cmdlet 修改的数据库的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Edition
指定Azure SQL 数据库的新版本。 有效值为:
- 无
- Web
- 业务
- 基本
- 标准
- 高级
类型: | DatabaseEdition |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Force
允许操作完成,而无需提示你进行确认。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-MaxSizeBytes
指定数据库的新最大大小(以字节为单位)。 可以指定此参数或 MaxSizeGB 参数。 有关基于版本的可接受值,请参阅 MaxSizeGB 参数。
类型: | Int64 |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-MaxSizeGB
指定数据库的新最大大小(以 GB 为单位)。 可以指定此参数或 MaxSizeBytes 参数。 可接受的值因版本而异。
基本版值:1 或 2
标准版值:1、2、5、10、20、30、40、50、100、150、200 或 250
Premium Edition 值:1、2、5、10、20、30、40、50、100、150、200、250、300、400 或 500
Web 版本值:1 或 5
Business Edition 值:10、20、30、40、50、100 或 150
类型: | Int32 |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-NewDatabaseName
指定数据库的新名称。
类型: | String |
别名: | NewName |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-PassThru
返回更新Azure SQL 数据库。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Profile
指定此 cmdlet 从中读取的 Azure 配置文件。 如果未指定配置文件,此 cmdlet 将从本地默认配置文件中读取。
类型: | AzureSMProfile |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ServerName
指定包含此 cmdlet 修改的数据库的服务器的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ServiceObjective
指定表示此数据库的新服务目标(性能级别)的对象。 有效值为:
- 基本:dd6d99bb-f193-4ec1-86f2-43d3bccbc49c
- 标准 (S0): f1173c43-91bd-4aaa-973c-54e79e15235b
- 标准 (S1): 1b1ebd4d-d903-4baa-97f9-4ea675f5e928
- 标准 (S2): 455330e1-00cd-488b-b5fa-177c226f28b7
- *标准 (S3): 789681b8-ca10-4eb0-bdf2-e0b050601b40
- Premium (P1): 7203483a-c4fb-4304-9e9f-17c71c904f5d
- Premium (P2):a7d1b92d-c987-4375-b54d-2b1d0e0f5bb0
- Premium (P3):a7c4c615-cfb1-464b-b252-925be0a19446
*标准版(S3)是最新SQL 数据库更新 V12(预览版)的一部分。 有关详细信息,请参阅 Azure SQL 数据库 V12 预览版中的新增功能https://azure.microsoft.com/documentation/articles/sql-database-preview-whats-new/.
类型: | ServiceObjective |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Sync
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示运行该 cmdlet 时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | False |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输入
Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database
输出
Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database