查询将.bak文件还原到新数据库?

时间:2013-10-08 15:26:36

标签: sql sql-server-2008 database-backups

我正在使用此查询将备份文件还原到新数据库。

RESTORE FILELISTONLY
FROM DISK = 'D:\abc.bak'

RESTORE DATABASE TestDB2 
FROM disk = 'D:\abc.bak'
WITH
MOVE 'cse' TO 'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL \DATA\TestDB2.mdf',
MOVE 'cse_log' TO 'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\TestDB2_log.ldf'
GO

但这是一个错误:

  

Msg 3132,Level 16,State 1,Line 1
  媒体集有2个媒体系列,但只提供了1个。必须提供所有成员   消息3013,级别16,状态1,行1   RESTORE DATABASE异常终止。

我是SQL Server 2008的新手。请帮忙。

1 个答案:

答案 0 :(得分:-1)

RESTORE DATABASE TestDB2 
FROM DISK = 'D:\abc.bak'
WITH FILE = 1,  
MOVE 'CSE' TO N'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL \DATA\TestDB2.mdf',  
MOVE N'(your DB name)_LOG' TO N'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\TestDB2_log.ldf',  
NOUNLOAD,  
REPLACE,  
STATS = 10
GO