Restore SQL Server database to Linux Docker

Vincent picture Vincent · Jan 18, 2017 · Viewed 9k times · Source

I need to restore a large SQL Server database on a Linux Docker instance (https://hub.docker.com/r/microsoft/mssql-server-linux/)

I'm moving my .bak file to the docker and executing this command in mssql shell:

RESTORE DATABASE gIMM_Brag FROM DISK = '/var/opt/mssql/backup/BackupFull8H_gIMM.bak' WITH MOVE '[gIMM].Data' T'/var/opt/mssql/data/gIMM.mdf', MOVE '[gIMM].Log' TO '/var/opt/mssql/data/gIMM.ldf', MOVE 'TraceabilityData' TO '/var/opt/mssql/data/gIMM.TraceData.mdf', MOVE 'TraceabilityIndexes' TO '/var/opt/mssql/data/gIMM.TraceIndex.mdf', MOVE 'KpiData' TO '/var/opt/mssql/data/gIMM.KpiData.mdf', MOVE 'KpiIndexes' TO '/var/opt/mssql/data/gIMM.KpiIndex.mdf'

I'm mapping correctly every file that need to and I definitely have enough space on the docker instance but I'm getting this error:

Error: The backup or restore was aborted.

The same error occurs with a windows version of this docker actually... And as it's not supposed to be a Express version, the database size shouldn't be the issue here.

If anyone has more information about what is causing this error !

Thanks,

Answer

Vinicius Krauspenhar picture Vinicius Krauspenhar · Oct 13, 2017

@TOUDIdel You have to use the actual file system paths on linux rather than the virtual paths that are shown in the error.

RESTORE DATABASE Northwind FROM DISK='/var/opt/mssql/Northwind.bak' WITH MOVE 'Northwind' TO '/var/opt/mssql/data/NORTHWND.MDF', MOVE 'Northwind_log' TO '/var/opt/mssql/data/NORTHWND_log.ldf'

http://www.raditha.com/blog/archives/restoring-a-database-on-ms-sql-server-for-linux-docker/