我已从Microsoft(AdventureWorks2014.bak)下载了演示数据库的备份,以便按照在线教程进行操作。
当我尝试使用以下查询恢复数据库时:
USE [master]
RESTORE DATABASE AdventureWorks2014
FROM disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\AdventureWorks2014.bak'
WITH MOVE 'AdventureWorks2014_data'
TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\AdventureWorks2014.mdf',
MOVE 'AdventureWorks2014_Log'
TO 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL \DATA\AdventureWorks2014.mdf',
REPLACE
我收到以下错误:
Msg 3176, Level 16, State 1, Line 3
File 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\AdventureWorks2014.mdf' is claimed by 'AdventureWorks2014_Log'(2) and 'AdventureWorks2014_Data'(1). The WITH MOVE clause can be used to relocate one or more files.
Msg 3013, Level 16, State 1, Line 3
RESTORE DATABASE is terminating abnormally.
服务器在我的系统上本地运行,并且我以管理员身份登录。我试图做以下事情无济于事:
但我仍然得到错误。非常感谢任何帮助
答案 0 :(得分:0)
尝试移动数据并登录到同一目录。改变它并且它起作用
答案 1 :(得分:0)
尝试在代码的倒数第二行将AdventureWorks2014的文件扩展名从.mdf更改为.ldf。
文件扩展名.ldf用于保存数据库日志。