0

I am trying to restore database to Docker SQL Server. The backup was created on windows machine.

I was trying with Azure Data Studio and I am getting this error:

Restore Database: Microsoft.Data.SqlClient.SqlError: BACKUP LOG cannot be performed because there is no current database backup.

In Azure Data Studio runs this SQL when using built in wizard:

USE [master] BACKUP LOG [XXX] TO DISK = N'/var/opt/mssql/data/XXX_LogBackup_2020-07-21_20-30-59.bak' WITH NOFORMAT, NOINIT, NAME = N'XXX_LogBackup_2020-07-21_20-30-59', NOSKIP, NOREWIND, NOUNLOAD, NORECOVERY , STATS = 5 RESTORE DATABASE [XXX] FROM DISK = N'/BCP_YYY2020-07-07.bak' WITH FILE = 1, MOVE N'YYY' TO N'/var/opt/mssql/data/XXX.mdf', MOVE N'YYY_log' TO N'/var/opt/mssql/data/XXX_log.ldf', NOUNLOAD, STATS = 5 

I was also trying with DataGripr with SQL Server Backup/Restore plugin but It failed to.

Error message:The operating system returned the error '267(The directory name is invalid.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on '/var/opt/mssql/data/XXXXXX_log.ldf\XXXXXX.mdf'.

My linux config:

  • Manjaro 20.0.0.3
  • File system: BTRFS

I have no clue what I am doing wrong. Last time I had SQL Server on docker on Windows and I was able to restore database from file.

  • 1
    The first error suggests you are trying to restore a transaction log without a database backup. What is the SQL you are running here – Thom A Jul 21 '20 at 19:46
  • I am using built in wizard in Azure Data Studio. Just like in SSMS – Mikart Aerang Jul 21 '20 at 20:19
  • Which still runs SQL; they don't use APIs or similar to interact with SQL server, just SQL like everything else. We need the SQL you're running, which you can get by pressing the script button. – Thom A Jul 21 '20 at 20:24
  • USE [master] BACKUP LOG [XXX] TO DISK = N'/var/opt/mssql/data/XXX_LogBackup_2020-07-21_20-30-59.bak' WITH NOFORMAT, NOINIT, NAME = N'XXX_LogBackup_2020-07-21_20-30-59', NOSKIP, NOREWIND, NOUNLOAD, NORECOVERY , STATS = 5 RESTORE DATABASE [XXX] FROM DISK = N'/BCP_YYY2020-07-07.bak' WITH FILE = 1, MOVE N'YYY' TO N'/var/opt/mssql/data/XXX.mdf', MOVE N'YYY_log' TO N'/var/opt/mssql/data/XXX_log.ldf', NOUNLOAD, STATS = 5 – Mikart Aerang Jul 21 '20 at 20:33
  • Using SSMS with default options I am able to restore databse on windowse – Mikart Aerang Jul 21 '20 at 20:34
  • In the question, not the comments. – Thom A Jul 21 '20 at 23:46
  • Also, the SQL you have posted in the comments is for a `BACKUP` not a `RESTORE`. – Thom A Jul 22 '20 at 08:13
  • I have just noticed this, but I did not make any changes to script. I do not know why this works like this. I am just pointing wizard my backup file and I am hitting restore button. Just like in SSMS. I will try to remove BACKUP section. – Mikart Aerang Jul 22 '20 at 08:54

0 Answers0