sqlserver2008通过mdf与ldf还原数据库

时间:2022-06-01 07:04:51
USE master;
 GO
 CREATE DATABASE CardioScansEerver
     ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\CardioScanServer.mdf'),
     (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\CardioScanServer.ldf')
     FOR ATTACH;
 GO

注意,执行命令之前需要把mdf与ldf放在命令指定路径下。