Invoke-DatabaseBuild - Post build: ALTER DATABASE SET SINGLE_USER statement failing on Azure SQL MI
wstyp
Posts: 2 New member
Hello,
We are migrating to Azure SQL Managed Instance for all of our databases. We have found that the Invoke-DatabaseBuild is failing after the schema validation build step is done. It appears Invoke-DatabaseBuild attempts to set the database to single user mode before attempting to drop it. This is an invalid ALTER DATABASE command for Azure SQL Managed Instance. I could not immediately find a flag to skip setting single user mode.
We used sql profiler to identity the sql statements below.
ALTER DATABASE [sql_change_automation_f3a96260-d563-4bff-9153-c05f744974b7] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [sql_change_automation_f3a96260-d563-4bff-9153-c05f744974b7];
We are migrating to Azure SQL Managed Instance for all of our databases. We have found that the Invoke-DatabaseBuild is failing after the schema validation build step is done. It appears Invoke-DatabaseBuild attempts to set the database to single user mode before attempting to drop it. This is an invalid ALTER DATABASE command for Azure SQL Managed Instance. I could not immediately find a flag to skip setting single user mode.
We used sql profiler to identity the sql statements below.
ALTER DATABASE [sql_change_automation_f3a96260-d563-4bff-9153-c05f744974b7] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [sql_change_automation_f3a96260-d563-4bff-9153-c05f744974b7];
Tagged:
Answers
Unfortunately we don't support Azure SQL Managed Instances in SQL Change Automation, please see: https://documentation.red-gate.com/sca/getting-started/system-requirements/supported-sql-server-versions
If you wish to use Azure SQL MI, then you will need to use Flyway Desktop/Flyway which is part of our Flyway Enterprise tools
https://documentation.red-gate.com/home?_ga=2.53981549.497014671.1572435081-385040425.1572277860#flyway-enterprise
Kind regards
Dan Calver | Redgate Software
Have you visited our Help Center?