无法在github codespace中还原SQL Server数据库

发布于 2025-01-31 20:00:28 字数 839 浏览 4 评论 0原文

我有以下脚本,其中包含其相应的备份文件

USE [master]

RESTORE DATABASE [Imports]
FROM DISK = '/workspaces/Imports/.devcontainer/mssql/Imports.bak'
WITH MOVE 'Imports' TO '/var/opt/mssql/data/Imports.mdf',
MOVE 'Imports_log' TO '/var/opt/mssql/data/Imports_log.ldf',
FILE = 1,  NOUNLOAD,  STATS = 5
GO

在命令行中我执行此行,

/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MSSqlPasswd -d master -i /workspaces/Imports.devcontainer/mssql/restoreDataBases.sql

但我会得到此错误

将数据库上下文更改为“主”。

msg 3201,16级,状态2,服务器8738a617a215,第2行
无法打开备份设备'/workspaces/imports/.devcontainer/mssql/importaciones.bak'。操作系统错误2
(系统找不到指定的文件。)。

msg 3013,级别16,状态1,服务器8738a617a215,第2行
还原数据库异常终止。

I have the following script with its corresponding backup file

USE [master]

RESTORE DATABASE [Imports]
FROM DISK = '/workspaces/Imports/.devcontainer/mssql/Imports.bak'
WITH MOVE 'Imports' TO '/var/opt/mssql/data/Imports.mdf',
MOVE 'Imports_log' TO '/var/opt/mssql/data/Imports_log.ldf',
FILE = 1,  NOUNLOAD,  STATS = 5
GO

In command line I execute this line

/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P MSSqlPasswd -d master -i /workspaces/Imports.devcontainer/mssql/restoreDataBases.sql

but I get this error

Changed database context to 'master'.

Msg 3201, Level 16, State 2, Server 8738a617a215, Line 2
Cannot open backup device '/workspaces/Imports/.devcontainer/mssql/Importaciones.bak'. Operating system error 2
(The system cannot find the file specified.).

Msg 3013, Level 16, State 1, Server 8738a617a215, Line 2
RESTORE DATABASE is terminating abnormally.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文