We're in the process of a server migration from an on-premise server (Win2008R2) to Azure PaaS.
To move the databases, we used the Microsoft Data Migration Assistant (DMA) tool, which worked great and we can connect to the migrated Azure DB via SQL Server Management Studio.
Considering:
- Made quite a few changes to the migrated Azure database (tables, SPs, indexes) to work with the apps in Azure
- Combined multiple DBs from the on-prem server into one DB in Azure via DMA to save costs
- One on-premise database is continually being modified by insert and update operations (multiple tables) during the migration process
- When fully switching hosting in Azure we need to make sure all data is up-to-date. This will be done very early in the AM during which on-prem IIS websites are stopped assuring no DB operations are made, giving us a short window to migrate missing data
Question: What is the best and fastest way to migrate data (all vs missing/updated) considering the above?
Can this be achieved by following the below steps?
- Create a new empty Azure SQL database (to later hold all the tables of 5 on-prem databases)
- Via Microsoft Data Migration Assistant (DMA), migrate only the schema of that one on-prem database which is continually being modified by insert/update operations
- Via SQL Data Sync Agent, set up auto data sync (e.g. every 30 minutes) between the on-prem and Azure database
- After data sync up and running, via Microsoft Data Migration Assistant (DMA)- migrate schema and data of the rest of the on-prem databases (no data changes during migration process) into the single Azure database previously created and used for syncing
EDIT:
After enabling Data Sync in the Azure portal, the sync was unsuccessful due to the below logged errors:
- Member Database: MyAzureDb -> Tombstone cleanup failed with the exception "SqlException Error Code: -2146232060 - SqlError Number:18456, Message: Login failed.
- Member Database: MyAzureDb -> Database provisioning failed with the exception "SqlException Error Code: -2146232060 - SqlError Number:18456, Message: Login failed.
To fix 1 and 2 above tried: ALTER ROLE DataSync_executor ADD MEMBER [myUser];
but got Cannot add the principal 'myUser', because it does not exist or you do not have permission.
- Member Database:MyOnPremDb: -> Database provisioning failed with the exception "SqlException Error Code: -2146232060 - SqlError Number:325, Message: Incorrect syntax near 'MERGE'. You may need to set the compatibility level of the current database to a higher value to enable this feature. See help for the SET COMPATIBILITY_LEVEL option of ALTER DATABASE. SqlError Number:156, Message: Incorrect syntax near the keyword 'AS'.
The current compatibility level of the on-premise database is 80. Not sure what impact setting it to 100 will have to the production databse/apps.