Yes, you can switch an Azure SQL Database from "Provisioned" to "Serverless" and back to "Provisioned" without any data loss and with minimal downtime. This is particularly feasible for your scenario since you mentioned that your data warehouse primarily experiences activity during the nightly refresh, with minimal querying during the day.
To move a database between compute tiers, you can use either PowerShell, Azure CLI, or T-SQL commands. Here are the steps you would typically follow:
- Switch from Provisioned to Serverless: You can use the following T-SQL command to change the compute tier:
ReplaceALTER DATABASE yourDatabaseName MODIFY ( SERVICE_OBJECTIVE = 'YourServiceObjective') ;YourServiceObjectivewith the appropriate serverless service objective. - Switch back to Provisioned: Similarly, you can revert to the provisioned tier using a command like:
Again, replaceALTER DATABASE yourDatabaseName MODIFY ( SERVICE_OBJECTIVE = 'YourProvisionedServiceObjective') ;YourProvisionedServiceObjectivewith the desired service objective for the provisioned tier.
During these transitions, Azure ensures that your data remains intact. However, it's advisable to perform these operations during off-peak hours to minimize any potential impact on performance. Additionally, you can monitor the database's performance and costs during your testing period to determine if the serverless model meets your needs better than the provisioned model.
References: