您的位置:首页 > 数据库

restore database 恢复数据库

2012-04-09 14:14 197 查看
[align=center] [/align]

在sqlserver中用 restore database 恢复数据库 ,当不知道数据库的具体逻辑文件信息时,先用 restore filelistonly 查看

restore filelistonly from disk='D:\dbbak\数据库A_Bak'
LogicalName   PhysicalName           Type   FileGroupName  Size     MaxSize
数据库A_Data  D:\xuewei\数据库A_Data.MDF     D     PRIMARY 271450112 35184372080640
数据库A_data1  D:\xuewei\数据库A_data1_Data.NDF D     PRIMARY    3221225472 35184372080640
数据库A_Log D:\xuewei\数据库A_Log.LDF L NULL 8404074496 35184372080640

然后 执行 restore database 恢复数据库
restore database 数据库A from disk='D:\dbbak\数据库A_Bak'
with
move '数据库A_data' to 'D:\dbbak\数据库A_Data.MDF',
move '数据库A_data1' to 'D:\dbbak\数据库A_data1_Data.NDF',
move '数据库A_log' to 'D:\dbbak\数据库A_Log.LDF',
replace
go

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: