【问题标题】:Restore database SQL Server linux恢复数据库 SQL Server linux
【发布时间】:2021-12-23 01:09:13
【问题描述】:

我在 linux 中恢复数据库 sql 服务器,但路径有问题。我的Sql Server版本是2019,版本是develop。

我用:

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:\DATA\balmaceda\cliente.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:\DATA\balmaceda\cliente.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:\LOG\cliente\cliente_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:\LOG\cliente\cliente_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.

【问题讨论】:

  • 您是否阅读了错误信息? Use WITH MOVE to identify a valid location for the file.
  • "无法恢复到 'F:\DATA\balmaceda\cliente.mdf'。" 不...这不是有效的 Unix (like) 路径。

标签: sql sql-server linux ssms


【解决方案1】:

最后我找到了回复:DBeaver restore SQL Server .bak file

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'"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多