How to use T-SQL to scale Azure SQL Server

You can use T-SQL to scale up/down Azure SQL Server:

ALTER DATABASE AzureDBName MODIFY (EDITION ='Standard', SERVICE_OBJECTIVE = 'S0', MAXSIZE = 10 GB); --S4:200; S6:400; S7:800

You can use the T-SQL to check the current db setting, or hardcoded the db name and run this in Master DB.

SELECT DATABASEPROPERTYEX(DB_NAME(), 'Edition') as Edition
, DATABASEPROPERTYEX(DB_NAME(), 'ServiceObjective') as ServiceObjective
, DATABASEPROPERTYEX(DB_NAME(), 'MaxSizeInBytes') as MaxSizeInBytes

To check the DB scaling progress, you can use T-SQL in Master DB:

SELECT  * 
FROM sys.dm_operation_status

With the T-SQL Alter database command, you can use SQL agent to easily schedule your database scale up/down.

Back To Top