There are more “modern ways” to achieve a similar goal, Azure functions, Logic apps etc but I wanted to share this classic approach. The scale down stored proc is as simple as:ĪLTER DATABASE MODIFY (SERVICE_OBJECTIVE = 'S0') So, I know after 8pm I do not need this tier, so I schedule a scale down from S3 to S0 8pm. The point of this job, is that so I can schedule it.ĪLTER DATABASE MODIFY (SERVICE_OBJECTIVE = 'S3') I have created a SQL agent job that calls a stored procedure in Azure SQL DB to scale up. ServiceObjective = DATABASEPROPERTYEX('DB1', 'ServiceObjective') SELECT Edition = DATABASEPROPERTYEX('DB1', 'Edition'), Once the linked server is created – test connection.Ĭurrently I have a database in Azure that is S0. Obviously, this is not possible out of the box but I have been using an on-premises SQL Server instance (within a specific vnet that is mapped to the logical Azure SQL server) with a linked server connection setup (with dedicated logins) to Azure SQL Database to run some code at a specific time to scale up (and down) my database dependent on peak hours. Personally, for me, the go to standard is the functionality of SQL Server Agent. I always wanted a way to schedule commands within Azure SQL Database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |