windows的備份因爲路徑問題,在Linux上會報錯linux
File 'YourDB_Product' cannot be restored to 'Z:\Microsoft SQL Server\MSSQL11.GLOBAL\MSSQL\Data\YourDB\YourDB_Product.ndf'. Use WITH MOVE to identify a valid location for the file. Msg 5133, Level 16, State 1, Server servername, Line 1 Directory lookup for the file "Z:\Microsoft SQL Server\MSSQL11.GLOBAL\MSSQL\Data\YourDB\YourDB_Product.ndf" failed with the operating system error 2(The system cannot find the file specified.).
此時須要設置還原後的文件存儲路徑,以下:sql
RESTORE FILELISTONLY FROM DISK = '/var/opt/mssql/backup/YourDB.bak' GO LogicalName PhysicalName .............. ---------------------------------------------------------------------------------------------------------------------- YourDB Z:\Microsoft SQL Server\MSSQL11.GLOBAL\MSSQL\Data\YourDB\YourDB.mdf .............. YourDB_Product Z:\Microsoft SQL Server\MSSQL11.GLOBAL\MSSQL\Data\YourDB\YourDB_Product.ndf .............. YourDB_Customer Z:\Microsoft SQL Server\MSSQL11.GLOBAL\MSSQL\Data\YourDB\YourDB_Customer.ndf .............. YourDB_log Z:\Microsoft SQL Server\MSSQL11.GLOBAL\MSSQL\Data\YourDB\YourDB_Log.ldf .............. You can use this list to create MOVE clauses for the additional files. In this example, the RESTORE DATABASE is: RESTORE DATABASE YourDB FROM DISK = '/var/opt/mssql/backup/YourDB.bak' WITH MOVE 'YourDB' TO '/var/opt/mssql/data/YourDB.mdf', MOVE 'YourDB_Product' TO '/var/opt/mssql/data/YourDB_Product.ndf', MOVE 'YourDB_Customer' TO '/var/opt/mssql/data/YourDB_Customer.ndf', MOVE 'YourDB_Log' TO '/var/opt/mssql/data/YourDB_Log.ldf' GO
參考:https://docs.microsoft.com/zh-cn/sql/linux/sql-server-linux-migrate-restore-database?view=sql-server-2017windows