每次我从CodePlex下载推荐的版本时,我得到的只是一个AdventureWorks2008.mdf文件.我不仅无法从sql Server Management Studio附加文件,而且无法将文件直接复制/粘贴到数据库中.
我在几个地方读过我需要使用AdventureWorks2008.msi,但我找不到下载它的位置.
我只是想不通如何安装AdventureWorks2008
谢谢你的帮助
解决方法
您需要创建数据库并附加.mdf文件,该文件是说明中提到的“数据文件”. (.mdf =主数据文件,.ldf =日志文件,.ndf =辅助数据文件)
要附加文件,您需要确保仔细按照此处的步骤操作:http://social.technet.microsoft.com/wiki/contents/articles/3735.sql-server-samples-readme-en-us.aspx#Readme_for_Adventure_Works_Sample_Databases
2008R2的说明:
To install AdventureWorks2008R2 OLTP database
Download the AdventureWorks2008R2 Data File.
From File Download,click Save and browse to a location on your local
server.From sql Server Management Studio,execute the following code:
Case-insensitive Database
@H_301_40@CREATE DATABASE AdventureWorks2008R2 ON (FILENAME = '{drive}:\{file path}\AdventureWorks2008R2_Data.mdf') FOR ATTACH_REBUILD_LOG;As an alternative to step 3,you can attach the database using the sql
Server Management Studio user interface. For more detailed
information,see 07001.Note: You must remove the log file from the list of files to attach.
@H_301_40@
This will cause the operation to rebuild the log.Aaron Bertrand的头痛保护技巧:
You should place the mdf file in your normal data folder – sql Server
@H_301_40@
will already have the proper permissions. You can get this path usingSELECT TOP(1)physical_name FROM master.sys.database_files;