< Back

Set-AzureRmSqlDatabase

Tue Jan 29, 2019 10:10 pm

NAME Set-AzureRmSqlDatabase



SYNOPSIS

Sets properties for a database, or moves an existing database into an elastic pool.





SYNTAX

Set-AzureRmSqlDatabase [-ResourceGroupName] <String> [-ServerName] <String> [-DatabaseName] <String> [-AsJob] [-DefaultProfile

<IAzureContextContainer>] [-Edition {None | Premium | Basic | Standard | DataWarehouse | Stretch | Free | PremiumRS}] [-ElasticPoolName <String>]

[-MaxSizeBytes <Int64>] [-ReadScale {Disabled | Enabled}] [-RequestedServiceObjectiveName <String>] [-Tags <Hashtable>] [-ZoneRedundant]

[-Confirm] [-WhatIf] [<CommonParameters>]



Set-AzureRmSqlDatabase [-ResourceGroupName] <String> [-ServerName] <String> [-DatabaseName] <String> [-AsJob] [-DefaultProfile

<IAzureContextContainer>] -NewName <String> [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Set-AzureRmSqlDatabase cmdlet sets properties for a database in Azure SQL Database. This cmdlet can modify the service tier ( Edition ),

performance level ( RequestedServiceObjectiveName ), and storage max size ( MaxSizeBytes ) for the database. In addition, you can specify the

ElasticPoolName parameter to move a database into an elastic pool. If a database is already in an elastic pool, you can use the

RequestedServiceObjectiveName parameter to move the database out of an elastic pool and into a performance level for single databases.





PARAMETERS

-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-DatabaseName <String>

Specifies the name of the database.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Edition <DatabaseEdition>

Specifies the edition for the database. The acceptable values for this parameter are:



- None



- Premium



- Basic



- Standard



- DataWarehouse



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ElasticPoolName <String>

Specifies name of the elastic pool in which to move the database.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MaxSizeBytes <Int64>

The maximum size of the Azure SQL Database in bytes.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-NewName <String>

The new name to rename the database to.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ReadScale <DatabaseReadScale>

The read scale option to assign to the Azure SQL Database.(Enabled/Disabled)



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-RequestedServiceObjectiveName <String>

Specifies the name of the service objective to assign to the database. For information about service objectives, see Azure SQL Database

Service Tiers and Performance Levels (https://msdn.microsoft.com/en-us/librar ... 41336.aspx)in the Microsoft Developer Network Library.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ResourceGroupName <String>

Specifies the name of resource group to which the server is assigned.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServerName <String>

Specifies the name of the server that hosts the database.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Tags <Hashtable>

Key-value pairs in the form of a hash table. For example:



@{key0="value0";key1=$null;key2="value2"}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ZoneRedundant [<SwitchParameter>]

The zone redundancy to associate with the Azure Sql Database



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel







NOTES









Example 1: Update a database to a Standard S2 database



PS C:\\>Set-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -DatabaseName "Database01" -ServerName "Server01" -Edition "Standard"

-RequestedServiceObjectiveName "S2"

ResourceGroupName : ResourceGroup01

ServerName : Server01

DatabaseName : Database01

Location : Central US

DatabaseId : a1e6bd1a-735a-4d48-8b98-afead5ef1218

Edition : Standard

CollationName : SQL_Latin1_General_CP1_CI_AS

CatalogCollation :

MaxSizeBytes : 268435456000

Status : Online

CreationDate : 7/3/2015 7:33:37 AM

CurrentServiceObjectiveId : 455330e1-00cd-488b-b5fa-177c226f28b7

CurrentServiceObjectiveName : S2

RequestedServiceObjectiveId : 455330e1-00cd-488b-b5fa-177c226f28b7

RequestedServiceObjectiveName :

ElasticPoolName :

EarliestRestoreDate :

Tags :



This command updates a database named Database01 to a Standard S2 database on a server named Server01.





Example 2: Add a database to an elastic pool



PS C:\\>Set-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -DatabaseName "Database01" -ServerName "Server01" -ElasticPoolName

"ElasticPool01"

ResourceGroupName : ResourceGroup01

ServerName : Server01

DatabaseName : Database01

Location : Central US

DatabaseId : a1e6bd1a-735a-4d48-8b98-afead5ef1218

Edition : Standard

CollationName : SQL_Latin1_General_CP1_CI_AS

CatalogCollation :

MaxSizeBytes : 268435456000

Status : Online

CreationDate : 7/3/2015 7:33:37 AM

CurrentServiceObjectiveId : d1737d22-a8ea-4de7-9bd0-33395d2a7419

CurrentServiceObjectiveName : ElasticPool

RequestedServiceObjectiveId : d1737d22-a8ea-4de7-9bd0-33395d2a7419

RequestedServiceObjectiveName :

ElasticPoolName : elasticpool01

EarliestRestoreDate :

Tags :



This command adds a database named Database01 to the elastic pool named ElasticPool01 hosted on the server named Server01.





Example 3: Modify the storage max size of a database



PS C:\\>Set-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -DatabaseName "Database01" -ServerName "Server01" -MaxSizeBytes 1099511627776

ResourceGroupName : ResourceGroup01

ServerName : Server01

DatabaseName : Database01

Location : Central US

DatabaseId : a1e6bd1a-735a-4d48-8b98-afead5ef1218

Edition : Standard

CollationName : SQL_Latin1_General_CP1_CI_AS

CatalogCollation :

MaxSizeBytes : 1099511627776

Status : Online

CreationDate : 8/24/2017 9:00:37 AM

CurrentServiceObjectiveId : 789681b8-ca10-4eb0-bdf2-e0b050601b40

CurrentServiceObjectiveName : S3

RequestedServiceObjectiveId : 789681b8-ca10-4eb0-bdf2-e0b050601b40

RequestedServiceObjectiveName :

ElasticPoolName :

EarliestRestoreDate :

Tags :



This command updates a database named Database01 to set its max size to 1 TB.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... qldatabase

Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy

New-AzureRmSqlDatabase

Remove-AzureRmSqlDatabase

Resume-AzureRmSqlDatabase

Suspend-AzureRmSqlDatabase

SQL Database Documentation https://docs.microsoft.com/azure/sql-database/