1.拷贝mdf ldf文件到某个文件夹下
2.打开SQL执行语句:
USE master; GO CREATE DATABASE NewFile ON (FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAFile.mdf'), (FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAFile_log.ldf') FOR ATTACH; GO
3.如果出现拒绝访问,则设置下mdf 和 ldf的文件安全。