首页 > 代码库 > sqlserver还原bak备份文件

sqlserver还原bak备份文件

先查看数据库逻辑名称:

restore filelistonly from disk=‘D:/database.bak‘

然后恢复:

restore database smsdb from disk = ‘d:\smsdb.bak‘with move ‘数据库逻辑名称‘     to ‘C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\db_data.mdf‘    ,move ‘日志逻辑名称‘ to ‘C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\db_log.ldf‘