Sql-server – sql server – Restoring Windows Database Backup File on a Linux Server Instance

backuplinuxsql server

I need to work with a SQL server instance, however my workspace runs Linux and the database backup that was given to me was running on Windows.

I succesfully managed to install SQL Server on my Linux environment, and I'm using DBeaver to access it, the main problem I have is when I try to restore this .bkp file in my SQL Server instance.

I'm trying to restore the database with this SQL command I read in an answer in this site, however I need the Logical Data File Name and the Logical Data Log. So I ran the next SQL command.

RESTORE DATABASE FILELISTONLY
FROM DISK = '/var/tmp/(redacted).bkp';

I get SQL Error 5133

SQL Error [5133][S0001]: Directory lookup for the file "D:\SQL2012\DATA\(redacted).mdf" failed with the operating system error 2(The system cannot find the file specified.).

Is it possible to restore this file? If so what am I doing wrong?

Thanks in advance.

Best Answer

Depending on what build you are using .. if you are getting an error then it might be a bug that you need to report to Microsoft.

You can still give the undocumented - sp_restore_filelistonly a try but it is just a wrapper as Brent says in his answer :

EXEC sp_restore_filelistonly
    @device_type = 'DISK',
    @backup_path = '/var/tmp/(redacted).bkp';

If above does not work, then for sure open a bug report with Microsoft.

It works for me - I have tested (Microsoft SQL Server 2017 (RTM-CU4) (KB4056498) - 14.0.3022.28 (X64) Feb 9 2018 19:39:09 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS)) and for me it works using both (restore filelistonly and using undocumented sp)

  • restore filelistonly from disk = '/var/opt/mssql/backup/dbname_(FULL)_20170108_020026.bak'

enter image description here