首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >还原数据库SQL Server linux

还原数据库SQL Server linux
EN

Stack Overflow用户
提问于 2021-11-10 12:23:31
回答 1查看 431关注 0票数 0

我是在linux中恢复数据库sql服务器,我对路径有问题。我的Server版本是2019年,版本正在开发。

我用:

代码语言:javascript
运行
复制
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"

产出如下:

代码语言:javascript
运行
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2021-11-10 12:45:36

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

代码语言:javascript
运行
复制
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'"
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69913205

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档