14
votes

I'm extremely new to databases so please bear with me.

I've set up local SQL Server running on a Docker container (using a Mac). I'm trying to restore SQL database using Azure Data Studio (v1.14.0) but it's not working.

I used the guide on database.guide but keep getting errors. I have no clue what it means.

Restore database failed: collection was modified; enumeration operation may not execute

I have tried restoring .bak-file from a backup made on my school computer (used SQL Server Management Studio on a PC), tried restoring with the bak-file from Database.guide. I also made a backup from my current DB in Azure and tried restoring that one - didn't work either.

1
What was the actual SQL you ran?Larnu
@Larnu I didn't, I just used Azure Data Studio as UI, following the steps from database.guide but I'm stuck at step 6.SpaceMonkeyMonty
That still runs SQL. Both SSMS and ADS have a Script button. Show us the script.Larnu
@Larnu I'm not sure how to do that, I started using ADS two days ago. When restoring backup I tried clicking the script-button (it immediately ran automated script I'm guessing) but got the same error. I don't know how to retrieve the actual SQL that ran when trying to restore the backup.SpaceMonkeyMonty
You press the Script button. It's literally labeled "Script".Larnu

1 Answers

27
votes

I finally got it to work! When restoring, in the files tab I ticked the box "Relocate all files" and specified the location to relocate the data and log files to /var/opt/mssql/data and that worked.