1.拷贝mdf ldf文件到某个文件夹下
2.打开SQL执行语句:
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.如果出现拒绝访问,则设置下mdf 和 ldf的文件安全。
时间: 2024-10-04 08:02:26