ldf和mdf文件怎么还原到sqlserver数据库
1、把mdf文件和ldf文件拷贝到数据库的默认路径C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA里;
2、在sqlserver里新建个查询,执行下面代码;
USE master; GO CREATE DATABASE NewFile ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\File.mdf'), (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\File_log.ldf') FOR ATTACH; GO
3、刷新数据库,就出现了新的数据库NewFile;
根据mdf文件和ldf文件还原成功!
posted on 2019-06-27 15:20 Test-Admin 阅读(6645) 评论(0) 编辑 收藏 举报