命令行下从bak文件恢复sqlserver数据库方法

命令行下从bak文件恢复sqlserver数据库方法

注:本文所示访问从SqlServer 2000 - 2014版都是通用的

参考:http://blog.sina.com.cn/s/blog_5cdf6f450102dwir.html

1.先使用restore filelistonly命令显示数据库的逻辑文件名和数据库名称

1
restore filelistonly from disk = 'E:\BaiduYunDownload\shifenzheng.bak'

  

2.进行恢复

1
2
3
4
restore database kaifang
from disk = 'E:\BaiduYunDownload\shifenzheng.bak'
with move 'linshi' to 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\linshi.mdf',
move 'linshi_log' to 'D:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\linshi_log.ldf'

  

posted @ 2018-03-14 16:45  昨日微风  阅读(4083)  评论(0编辑  收藏  举报