Powershell 脚本将 Azure SQL 数据库存储大小增加 10%
Powershell script increasing Azure SQL Database storage size with 10%
我需要创建 powershell 脚本来增加 Azure SQL 数据库存储 space 10%。
使用 GB 不是问题,但我不知道如何使用 % 来实现。
我有这样的东西:
= Get-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb"
= .MaxSizeBytes
但是如何指出 MAXSizeBytes 将是 100% 并再增加 10%?
您必须使用 Set-AzSqlDatabase 并将参数 -MaxSizeBytes
设置为所需的值。
应该是这样的:
$db = Get-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb"
Set-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb" -MaxSizeBytes $($db.MaxSizeBytes*1.1)
您可能需要检查 Azure 门户中的有效大小。
根据此 值仅限于特定尺寸。
我需要创建 powershell 脚本来增加 Azure SQL 数据库存储 space 10%。 使用 GB 不是问题,但我不知道如何使用 % 来实现。 我有这样的东西:
= Get-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb"
= .MaxSizeBytes
但是如何指出 MAXSizeBytes 将是 100% 并再增加 10%?
您必须使用 Set-AzSqlDatabase 并将参数 -MaxSizeBytes
设置为所需的值。
应该是这样的:
$db = Get-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb"
Set-AzSqlDatabase -ResourceGroupName "testRG" -ServerName "test-sql" -DatabaseName "test-sqldb" -MaxSizeBytes $($db.MaxSizeBytes*1.1)
您可能需要检查 Azure 门户中的有效大小。
根据此