For general information about this project and contributing, see README.md.
This document describes the Self-Service Maintenance process for Azure SQL Database and Azure SQL Managed Instance.
Step 1. You receive a Pending Self-Service Maintenance notification.
Step 2. You initiate failover to upgrade databases.
Step 3. The system initiates failover for any remaining databases.
You receive a maintenance notification for an upcoming maintenance period. The content will look like:
Planned Maintenance Notification for Azure SQL Database
The activity log alert SelfServiceMaintenanceExampleAlert was triggered for the Azure subscription SelfServiceMaintenanceExampleSub.
Tracking ID: VL9X-TP8, Type: Maintenance
Status: Planned
Communication:
This notification is for new pending maintenance to your Azure SQL DB instance(s) in Korea Central and JapanEast. Planned maintenance is ready in all named regions. You may initiate upgrade of your databases at any time. During maintenance, your Azure SQL DB instance(s) may experience a brief drop in connectivity for a short number of seconds. If you do not trigger an upgrade for a database, maintenance will occur automatically at 2:37 UTC on 3 Jul 2023, or at a later date and time. Please refer to the upgrade documentation (https://aka.ms/azsqlcmwselfservicemaint) for more information. For any additional questions, please contact support.
Note:
:exclamation: Important: The process described below is appropriate if you wish to trigger failover for a small number of databases. For simplified failover of dozens or hundreds of SQL DB resources, you can deploy AzureSqlBulkFailover into a subscription and grant the automation account access to the resource group that contains your databases and then use use AzureSqlBulkFailover to trigger the failover at the desired time. Currently this solution doesn’t support Azure SQL MI resources.
Set-AzContext -Subscription <subscription_guid>
Invoke-AzSqlDatabaseFailover -ResourceGroupName <resource group name> -ServerName <SQL server name> -DatabaseName <database name>
Invoke-AzSqlElasticPoolFailover -ResourceGroupName <resource group name> -ServerName <SQL server name> -ElasticPoolName <elastic pool>
Invoke-AzSqlInstanceFailover -ResourceGroupName <resource group name> -Name <managed instance name>
The upgrade will require from a few seconds to a minute or two per database or pool. When the command completes, the upgrade of that database or pool of databases is complete. There is no output if the operation is successful. You will receive an error if the operation fails.
At some point after the deadline time mentioned in the Pending maintenance notification, the system will force failover for any remaining databases. In the current version of the system, this failover may not occur at the precise deadline time; system-initiated failover will not occur before the deadline, but it may occur several hours or even several days after the deadline time. For this reason, we encourage you to invoke the failover command for all critical databases at an appropriate time.
After all databases are upgraded, you will receive another maintenance notification with status “Complete” for the same maintenance event ID. Please note that a maintenance event typically covers many databases. And, in the current system, the “Complete” notification may be sent several hours or even days after the last database failover has occurred. The upgrade for any particular database is complete as soon as the failover command has completed.
These instructions allow failover of from one to a few databases. We have implemented the AzureSqlBulkFailover runbook as a simplified way to trigger failover of many databases at the same time. Instruction for deployment and usage are provided here.
Currently, using this failover technique, a single database will be failedover in seconds and a server with a large number of databases will be completely failed over within 15 to 30 minutes, although most servers will require less than 5 minutes. We will be monitoring the system to collect data about performance under a variety of conditions, and we will look for opportunities to provide the most consistent experience.
Azure SQL Self-Service Maintenance does not yet provide precise system-initiated upgrade. The customer must initiate the upgrade. We are planning to add scheduled failover features in the future. However, if you are using Self-Service Maintenance and you are notified of a maintenance event, we will failover the database soon after the deadline and in the future at the deadline. Another way that a scheduled maintenance can be implemented for customers that have Self-Service Maintenance is by automating the runbook execution at a specific time during the maintenance window. For more information, see Automate Runbook Execution
The widely-available Azure SQL Maintenance Window features allow customers to limit planned maintenance to either weekday (Monday - Thursday) or weekend (Friday - Sunday) evenings, 10pm to 6am. This document relates to a new, pre-release capability that provides more precise maintenance windows, and increases customer control by allowing customers to directly initiate the upgrade of particular databases.