SQL Server 2012安装Adventure Works数据库

参考文献:http://social.msdn.microsoft.com/Forums/en-US/sqlgetstarted/thread/ec2ed3ae-eae9-427f-b8ad-9605fe67477a

1.在http://msftdbprodsamples.codeplex.com/releases/view/55330下载AdventureWorks2012 Data File,下载后的文件名是AdventureWorks2012_Data.mdf。

2.使用sqlserver management studio来attach(附加数据库)。

3.我们下载的只有.mdf文件,没有log文件,但是我们在附件mdf文件的时候,会自动带上log文件,而且显示没有这个log文件。我们删除这个log文件,最后点击确定即可完成数据的安装。

假如我们不杀出log文件,会报错,错误如下:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Attach database failed for Server ******.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2100.60+((SQL11_RTM).120210-1846+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

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

------------------------------

Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Log.ldf". Operating system error 2: "2(The system cannot find the file specified.)". (Microsoft SQL Server, Error: 5120)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.2100&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

原文地址:https://www.cnblogs.com/xwdreamer/p/2561548.html