Sql-server – Attach database failed for Server ‘{SERVER_NAME}\{INSTANCE_NAME}’. (Microsoft.SqlServer.Smo)

sql-server-2008

Strange, I tried to attach the database AdventureWorks from this site – http://sqlserversamples.codeplex.com/

However, I encounter the following problem while attaching AdventureWorks2008R2_Data.mdf

Attach database failed for Server '{SERVER_NAME}{INSTANCE_NAME}'. (Microsoft.SqlServer.Smo)

Additional Information:

An Exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Directory Lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10.50.MSSQLSERVER\MSSQL\DATA\AdventureWorks2008R2_Log.ldf" failed with the operating system error 3 (The system cannot find the path specified.). (Microsoft SQL Server, Error: 5133)

Best Answer

You need the "AdventureWorks2008R2_Log.ldf" file. And put it in this folder: "C:\Program Files\Microsoft SQL Server\MSSQL10.50.MSSQLSERVER\MSSQL\DATA\"

The easiest thing to do is download the "full backup" file from that site and then restore it, (instead of attaching.)