还原数据库SQL Server linux



我在linux中恢复数据库sql server,路径有问题。我的Sql Server版本是2019,版本正在开发中。

我使用:

sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [prueba] FROM DISK = N'/var/opt/mssql/data/cliente.bak' WITH FILE = 1, NOUNLOAD, REPLACE, NORECOVERY, STATS = 5"

输出为:

Msg 5133, Level 16, State 1, Server myserver, Line 1
Directory lookup for the file "F:DATAbalmacedacliente.mdf" failed with the operating system error 2(The system cannot find the file specified.).
Msg 3156, Level 16, State 3, Server myserver, Line 1
File 'cliente' cannot be restored to 'F:DATAbalmacedacliente.mdf'. Use WITH MOVE to identify a valid location for the file.
Msg 5133, Level 16, State 1, Server myserver, Line 1
Directory lookup for the file "F:LOGclientecliente_log.ldf" failed with the operating system error 2(The system cannot find the file specified.).
Msg 3156, Level 16, State 3, Server myserver, Line 1
File 'cliente_log' cannot be restored to 'F:LOGclientecliente_log.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Server myserver, Line 1
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Server myserver, Line 1
RESTORE DATABASE is terminating abnormally.

最后我在:DBeaver restore SQL Server.bak文件中找到了响应

sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [prueba2] FROM DISK = N'/var/opt/mssql/data/cliente.bak' WITH MOVE 'cliente' TO '/var/opt/mssql/data/cliente.mdf', MOVE 'cliente' TO '/var/opt/mssql/data/cliente.ldf'"

最新更新