|
| 1 | +--- |
| 2 | +title: Convert a Database to Hyperscale |
| 3 | +description: How to convert an Azure SQL Database to the Hyperscale tier. |
| 4 | +author: WilliamDAssafMSFT |
| 5 | +ms.author: wiassaf |
| 6 | +ms.reviewer: dfurman, blakhani |
| 7 | +ms.date: 02/10/2025 |
| 8 | +ms.service: azure-sql-database |
| 9 | +ms.topic: how-to |
| 10 | +ms.custom: |
| 11 | + - devx-track-azurepowershell |
| 12 | + - devx-track-azurecli |
| 13 | +monikerRange: "=azuresql || =azuresql-db" |
| 14 | +--- |
| 15 | + |
| 16 | +# Convert an existing database to Hyperscale |
| 17 | + |
| 18 | +You can convert an existing database in Azure SQL Database to Hyperscale using the Azure portal, the Azure CLI, PowerShell, or Transact-SQL. |
| 19 | + |
| 20 | +## Cutover |
| 21 | + |
| 22 | +The conversion process is divided into two stages - the conversion of database, which occurs while the existing database is online, and then a cutover to the new Hyperscale database. |
| 23 | + |
| 24 | +- The time required to move an existing database to Hyperscale consists of the time to copy data and the time to replay the changes made in the source database while copying data. The data copy time is proportional to data size. We recommend converting to Hyperscale during a lower write activity period so that the time to replay accumulated changes is shorter. |
| 25 | +- You'll only experience a short period of downtime, generally less than a minute, during the final cutover to Hyperscale. You have the ability to choose when the cutover occurs - as soon as the database is ready, or manually at a time of your choosing. By default, the process to convert to Hypersacle will cutover automatically. |
| 26 | + |
| 27 | +> [!NOTE] |
| 28 | +> The ability to initiate a manual cutover for a conversion to Hyperscale is a preview feature. |
| 29 | +
|
| 30 | +In the current preview, during a conversion to Hyperscale, you have three days to initiate the manual cutover after the point when the database ready for cutover. You can initiate a manual cutover via the Azure portal, Azure CLI, PowerShell, or T-SQL. |
| 31 | + |
| 32 | +## Prerequisites |
| 33 | + |
| 34 | +To convert a database that is a part of a [geo-replication](active-geo-replication-overview.md) relationship, either as the primary or as a secondary, to Hyperscale, you need to first terminate geo-replication between the primary and secondary replica. Databases in a [failover group](failover-group-sql-db.md) must be removed from the group first. |
| 35 | + |
| 36 | +Once a database has been moved to Hyperscale, you can create a new Hyperscale geo-replica for that database or add the database to a failover group. |
| 37 | + |
| 38 | +Direct conversion from the Basic service tier to Hyperscale is not supported. To perform this conversion, first change the database to any service tier other than Basic (for example, General Purpose), and then proceed with the conversion to Hyperscale. |
| 39 | + |
| 40 | +## Convert a database to Hyperscale |
| 41 | + |
| 42 | +To convert an existing Azure SQL Database to Hyperscale, first identify your target service objective. |
| 43 | + |
| 44 | +Review [resource limits for single databases](resource-limits-vcore-single-databases.md) if you aren't sure which service objective is right for your database. In many cases, you can choose a service objective with the same number of vCores and the same hardware generation as the original database. If needed, you can [change the service objective](scale-resources.md) later with minimal downtime. Billing for Hyperscale begins only after cutover. |
| 45 | + |
| 46 | +Select the tab for your preferred method to convert your database: |
| 47 | + |
| 48 | +# [Portal](#tab/azure-portal) |
| 49 | + |
| 50 | +The Azure portal enables you to convert to Hyperscale by modifying the service tier for your database. |
| 51 | + |
| 52 | +:::image type="content" source="media/convert-to-hyperscale/service-tier-dropdown-azure-sql-database-azure-portal.png" alt-text="Screenshot of the compute + storage panel of a database in Azure SQL Database. The service tier dropdown is expanded, displaying the option for the Hyperscale service tier." lightbox="media/convert-to-hyperscale/service-tier-dropdown-azure-sql-database-azure-portal.png"::: |
| 53 | + |
| 54 | +1. Navigate to the database you wish to convert in the Azure portal. |
| 55 | +1. In the left navigation bar, select **Compute + storage**. |
| 56 | +1. Select the **Service tier** dropdown list to expand the options for service tiers. |
| 57 | + 1. If you were using the [Azure SQL Database free offer](free-offer.md), select the button to remove the **Free database offer**. Then you'll see the **Service tier** dropdown list. |
| 58 | +1. Select **Hyperscale** from the dropdown list. |
| 59 | +1. Review the **Compute tier** and choose **Provisioned** or **Serverless**. |
| 60 | +1. Review the **Cutover mode**, a choice specific to conversion to Hyperscale. |
| 61 | + - The cutover occurs after the database is prepared for conversion to Hyperscale. **Cutover mode** determines when connectivity to the existing Azure SQL Database will be momentarily disrupted for the conversion to Hyperscale: |
| 62 | + - **Automatic cutover** performs the cutover as soon as the Hyperscale database is ready. |
| 63 | + - **Manual cutover** prompts you to initiate the cutover at a time of your choice in the Azure portal. This option is most useful to time the cutover for minimal business disruption. |
| 64 | +1. Review the **Hardware Configuration** listed. If desired, select **Change configuration** to select the appropriate hardware configuration for your workload. |
| 65 | +1. Select the **vCores** slider if you wish to change the number of vCores available for your database under the Hyperscale service tier. |
| 66 | +1. Select the **High-Availability Secondary Replicas** slider if you wish to change the number of replicas under the Hyperscale service tier. |
| 67 | +1. Select **Apply**. |
| 68 | +1. Monitor the conversion in the Azure portal. |
| 69 | + 1. Navigate to the database in the Azure portal. |
| 70 | + 1. In the left navigation bar, select **Overview**. |
| 71 | + 1. Review the **Notifications** section at the bottom of the right pane. If operations are ongoing, a notification box appears. |
| 72 | + 1. Select the notification box to view details. |
| 73 | + 1. The **Ongoing operations** pane opens. Review the details of the ongoing operations. |
| 74 | + |
| 75 | +If you selected **Manual cutover**, the Azure portal will present you a **Cutover** button when ready. |
| 76 | + |
| 77 | +:::image type="content" source="media/convert-to-hyperscale/cutover.png" alt-text="Screenshot from the Azure portal showing the Cutover button in a Hyperscale conversion."::: |
| 78 | + |
| 79 | +# [Azure CLI](#tab/azure-cli) |
| 80 | + |
| 81 | +This code sample calls [az sql db update](/cli/azure/sql/db#az-sql-db-update) to convert an existing Azure SQL Database to Hyperscale. You must specify both the edition and service objective. Replace `resourceGroupName`, `serverName`, `databaseName`, and `serviceObjective` with the appropriate values before running the following code sample: |
| 82 | + |
| 83 | +```azurecli-interactive |
| 84 | +resourceGroupName="myResourceGroup" |
| 85 | +serverName="server01" |
| 86 | +databaseName="mySampleDatabase" |
| 87 | +serviceObjective="HS_Gen5_2" |
| 88 | +
|
| 89 | +az sql db update -g $resourceGroupName -s $serverName -n $databaseName \ |
| 90 | + --edition Hyperscale --service-objective $serviceObjective |
| 91 | +``` |
| 92 | + |
| 93 | +Use `--manual-cutover` to choose to manually initiate the cutover to Hyperscale at a time of your choice. This option is most useful to time the cutover for minimal business disruption. For example: |
| 94 | + |
| 95 | +```azurecli-interactive |
| 96 | +resourceGroupName="myResourceGroup" |
| 97 | +serverName="server01" |
| 98 | +databaseName="mySampleDatabase" |
| 99 | +serviceObjective="HS_Gen5_2" |
| 100 | +
|
| 101 | +az sql db update -g $resourceGroupName -s $serverName -n $databaseName --edition Hyperscale --service-objective $serviceObjective --manual-cutover |
| 102 | +``` |
| 103 | + |
| 104 | +Monitor the ongoing operation with [az sql db op list](/cli/azure/sql/db/op#az-sql-db-op-list), to return recent or ongoing operations for a database in Azure SQL Database. |
| 105 | + |
| 106 | +```azurecli-interactive |
| 107 | +resourceGroupName="myResourceGroup" |
| 108 | +serverName="server01" |
| 109 | +databaseName="mySampleDatabase" |
| 110 | +
|
| 111 | +az sql db op list -g $resourceGroupName -s $serverName -n $databaseName |
| 112 | +``` |
| 113 | + |
| 114 | +Use `--perform-cutover` to initiate the cutover (within 3 days) once the Hyperscale database is ready: |
| 115 | + |
| 116 | +```azurecli-interactive |
| 117 | +az sql db update -g $resourceGroupName -s $serverName -n $databaseName --perform-cutover |
| 118 | +``` |
| 119 | + |
| 120 | +# [PowerShell](#tab/azure-powershell) |
| 121 | + |
| 122 | +The following example uses the [Set-AzSqlDatabase](/powershell/module/az.sql/set-azsqldatabase) cmdlet to convert an existing Azure SQL Database to Hyperscale. You must specify both the edition and service objective. Replace `$resourceGroupName`, `$serverName`, `$databaseName`, and `$serviceObjective` with the appropriate values before running this code sample: |
| 123 | + |
| 124 | +```powershell-interactive |
| 125 | +$resourceGroupName = "myResourceGroup" |
| 126 | +$serverName = "server01" |
| 127 | +$databaseName = "mySampleDatabase" |
| 128 | +$serviceObjective = "HS_Gen5_2" |
| 129 | +
|
| 130 | +Set-AzSqlDatabase -ResourceGroupName $resourceGroupName ` |
| 131 | + -ServerName $serverName ` |
| 132 | + -DatabaseName $databaseName ` |
| 133 | + -Edition "Hyperscale" ` |
| 134 | + -RequestedServiceObjectiveName $serviceObjective |
| 135 | +``` |
| 136 | + |
| 137 | +Use `-ManualCutover` to manually initiate the cutover at a time of your choice. This option is most useful to time the cutover for minimal business disruption. For example: |
| 138 | + |
| 139 | +```powershell-interactive |
| 140 | +$resourceGroupName = "myResourceGroup" |
| 141 | +$serverName = "server01" |
| 142 | +$databaseName = "mySampleDatabase" |
| 143 | +$serviceObjective = "HS_Gen5_2" |
| 144 | +
|
| 145 | +Set-AzSqlDatabase -ResourceGroupName $resourceGroupName ` |
| 146 | + -ServerName $serverName ` |
| 147 | + -DatabaseName $databaseName ` |
| 148 | + -Edition "Hyperscale" ` |
| 149 | + -RequestedServiceObjectiveName $serviceObjective ` |
| 150 | + -ManualCutover |
| 151 | +``` |
| 152 | + |
| 153 | +Monitor the operation in progress with the [Get-AzSqlDatabaseActivity](/powershell/module/az.sql/get-azsqldatabaseactivity) cmdlet, which returns recent or ongoing operations for a database in Azure SQL Database. Set the `$resourceGroupName`, `$serverName`, and `$databaseName` parameters to the appropriate values for your database before running the sample code: |
| 154 | + |
| 155 | +```powershell-interactive |
| 156 | +$resourceGroupName = "myResourceGroup" |
| 157 | +$serverName = "server01" |
| 158 | +$databaseName = "mySampleDatabase" |
| 159 | +
|
| 160 | +Get-AzSqlDatabaseActivity -ResourceGroupName $resourceGroupName ` |
| 161 | + -ServerName $serverName ` |
| 162 | + -DatabaseName $databaseName |
| 163 | +``` |
| 164 | + |
| 165 | +Use `-PerformCutover` to initiate the cutover once the Hyperscale database is ready: |
| 166 | + |
| 167 | +```powershell-interactive |
| 168 | +$resourceGroupName = "myResourceGroup" |
| 169 | +$serverName = "server01" |
| 170 | +$databaseName = "mySampleDatabase" |
| 171 | +$serviceObjective = "HS_Gen5_2" |
| 172 | +
|
| 173 | +Set-AzSqlDatabase -ResourceGroupName $resourceGroupName ` |
| 174 | + -ServerName $serverName ` |
| 175 | + -DatabaseName $databaseName ` |
| 176 | + -Edition "Hyperscale" ` |
| 177 | + -RequestedServiceObjectiveName $serviceObjective ` |
| 178 | + -PerformCutover |
| 179 | +``` |
| 180 | + |
| 181 | +# [Transact-SQL](#tab/t-sql) |
| 182 | + |
| 183 | +To convert an existing Azure SQL Database to Hyperscale with Transact-SQL, first connect to the `master` database on your [logical SQL server](logical-servers.md) using the [Azure portal Query editor for Azure SQL Database](query-editor.md), [SQL Server Management Studio (SSMS)](/sql/ssms/download-sql-server-management-studio-ssms) or [the mssql extension for Visual Studio Code](/sql/tools/visual-studio-code-extensions/mssql/mssql-extension-visual-studio-code). |
| 184 | + |
| 185 | +You must specify both the edition and service objective in the [ALTER DATABASE](/sql/t-sql/statements/alter-database-transact-sql?view=azuresqldb-current&preserve-view=true) statement. |
| 186 | + |
| 187 | +This example statement converts a database named `mySampleDatabase` to Hyperscale with the `HS_Gen5_2` service objective. Replace the database name with the appropriate value before executing the statement. |
| 188 | + |
| 189 | +```sql |
| 190 | +ALTER DATABASE [mySampleDatabase] |
| 191 | + MODIFY (EDITION = 'Hyperscale', SERVICE_OBJECTIVE = 'HS_Gen5_2'); |
| 192 | +GO |
| 193 | +``` |
| 194 | + |
| 195 | +By default, the database will perform a cutover to the Hyperscale database to finish the conversion as soon as the Hyperscale database is available. Optionally, use the `MANUAL_CUTOVER` argument to instead start a conversion that will end with a manually initiated cutover, at a time of your choice. This option is most useful to time the cutover for minimal business disruption. For example: |
| 196 | + |
| 197 | +```sql |
| 198 | +ALTER DATABASE [mySampleDatabase] |
| 199 | + MODIFY (EDITION = 'Hyperscale', SERVICE_OBJECTIVE = 'HS_Gen5_2') |
| 200 | + WITH MANUAL_CUTOVER; |
| 201 | +``` |
| 202 | + |
| 203 | +To monitor operations for a Hyperscale database, connect to the `master` database of your [logical server](logical-servers.md) and query [sys.dm_operation_status](/sql/relational-databases/system-dynamic-management-views/sys-dm-operation-status-azure-sql-database?view=azuresqldb-current&preserve-view=true). The `sys.dm_operation_status` makes reports the progress of database operations including the conversion to Hyperscale. If you chose `MANUAL_CUTOVER`, the `sys.dm_operation_status` view includes additional information. |
| 204 | + |
| 205 | +```sql |
| 206 | +SELECT * |
| 207 | +FROM sys.dm_operation_status |
| 208 | +WHERE major_resource_id = 'mySampleDatabase' |
| 209 | +ORDER BY start_time DESC; |
| 210 | +GO |
| 211 | +``` |
| 212 | + |
| 213 | +When ready for manual cutover, the `phase_desc` will be `WaitingForCutover`. Use the `PERFORM_CUTOVER` argument to initiate the cutover: |
| 214 | + |
| 215 | +```sql |
| 216 | +ALTER DATABASE [mySampleDatabase] PERFORM_CUTOVER; |
| 217 | +``` |
| 218 | + |
| 219 | +--- |
| 220 | + |
| 221 | +## Related content |
| 222 | + |
| 223 | +- [How to manage a Hyperscale database](manage-hyperscale-database.md) |
| 224 | +- [How to reverse migrate a database from Hyperscale](reverse-migrate-from-hyperscale.md) |
0 commit comments