正在 Linux SQL 服务器上恢复 AdventureWorks2017 的备份

Restoring backup of AdventureWorks2017 on Linux SQL Server

我发现自己处于一个非常奇怪的境地:以前能用的东西现在不能用了。

我正在尝试使用此 T-SQL 代码在 Ubuntu 机器上的 SQL 服务器 运行 上恢复 Adventureworks 备份:

RESTORE DATABASE AdventureWorks2017
FROM DISK = '/home/sergey/AW/AdventureWorks2017.bak'
WITH MOVE 'AdventureWorks2017' TO '/home/sergey/AW/AdventureWorks2017.mdf',
     MOVE 'AdventureWorks2017_log' TO '/home/sergey/AW/AdventureWorks2017_log.ldf'
GO

但是我收到一个错误:

[S0001][3142] File "AdventureWorks2017" cannot be restored over the existing "/home/sergey/AW/AdventureWorks2017.mdf". Reissue the RESTORE statement using WITH REPLACE to overwrite pre-existing files, or WITH MOVE to identify an alternate location.

这篇博客 post 似乎在谈论类似的问题,但提到的食谱不起作用。

非常感谢任何帮助!

错误消息指出,目标文件已经存在。

尝试

RESTORE DATABASE AdventureWorks2017
FROM DISK = '/home/sergey/AW/AdventureWorks2017.bak'
WITH MOVE 'AdventureWorks2017' TO '/home/sergey/AW/AdventureWorks2017.mdf',
     MOVE 'AdventureWorks2017_log' TO '/home/sergey/AW/AdventureWorks2017_log.ldf',
     REPLACE
GO

可以找到 RESTORE Transact-SQL 命令的完整文档 here