本文介绍了在服务器2008 R2中附加没有ldf的mdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hI,

我有AdventureWorks2008R2_Data.mdf文件.并且我想将其附加到可能的Sql Server 2008R2数据库中.我没有ldf文件.我运行以下脚本..

hI,

I have AdventureWorks2008R2_Data.mdf file. and I want to attach it to may Sql Server 2008R2 database. I don''t have its ldf file though. I run the following script..

USE [master]
CREATE DATABASE Adventure ON
(FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER1\MSSQL\DATA\AdventureWorks2008R2_Data.mdf')
FOR ATTACH_REBUILD_LOG
GO 



它给我以下错误消息...



It gives me following message with an error...

Msg 5120, Level 16, State 101, Line 2
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER1\MSSQL\DATA\TestDb_log.LDF". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER1\MSSQL\DATA\TestDb_log.LDF" may be incorrect.
New log file 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER1\MSSQL\DATA\Adventure_log.LDF' was created.



如何摆脱这种情况?



How to get rid of this???

推荐答案


这篇关于在服务器2008 R2中附加没有ldf的mdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 02:01