Blog By Hal Hayes
Sunday, September 07, 2008

You can find the SQL Server 2008 sample databases on CodePlex, here.

 

The downloads are .msi files. I would prefer to have the base files and manually install, but I can understand why it was done this way - because SQL Server 2008 has more complex features and the idea is that these are demonstrated in the samples databases.

 

I downloaded the AdventureWorks2008 OLTP to try. First thing to know is that you have to set select the database for it to be installed. For whatever reason, the database restore is not selected by default. If you did not know that, you would think you had installed the database when you run the program.

 

Notice here (install for the Analysis Services samples) that the restore for the AdventureWorks DBs is not selected. Make sure you select the database you wan to install.

 

When I selected to run the program to install the database, I got this error:

 

Product: Microsoft SQL Server 2008 AdventureWorks OLTP Database (v2008) RTM Samples (x64) -- Error 26204. Error -2147217900: failed to execute SQL string, error detail: RESTORE DATABASE is terminating abnormally., SQL key: SqlString_RestoreAdventureWorks2008 SQL string: IF '1' = '1' BEGIN USE master; DECLARE @sql_path nvarchar(256); SELECT @sql_path = SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1) FROM master.sys.master_files WHERE database_id = 1 AND file_id = 1; IF EXISTS (SELECT * FROM sys.databases WHERE name = 'AdventureWorks2008') BEGIN EXECUTE (N'ALTER DATABASE AdventureWorks2008 SET SINGLE_USER WITH ROLLBACK IMMEDIATE;'); EXECUTE (N'DROP DATABASE AdventureWorks2008;'); END EXECUTE (N'RESTORE DATABASE AdventureWorks2008 FROM DISK = ''C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks2008.bak'' WITH MOVE ''AdventureWorks2008_Data'' TO N''' + @sql_path + N'AdventureWorks2008.mdf'', MOVE ''AdventureWorks2008_Log'' TO N''' + @sql_path + N'AdventureWorks2008.ldf'', MOVE ''FileStreamDocuments'' TO N''' + @sql_path + N'Documents'';'); EXECUTE (N'ALTER DATABASE AdventureWorks2008 SET NEW_BROKER;'); END

 

If you get this error then chances are you need to set up access for the filestream feature.

 

You can try to restore the backup. If you attempt it and get the following error, then it is indicative that the filestream feature has not been enabled:

 

Restore failed for Server '<SERVER>\SQL2008'.  (Microsoft.SqlServer.SmoExtended)

System.Data.SqlClient.SqlError: FILESTREAM feature is disabled. (Microsoft.SqlServer.Smo)

 

See Bob Beauchemin's Blog post on how to set this in Management Studio.

 

Also, link here of the MSDN description which includes setting the necessary values.

 

I ran the followng code and it successfully enabled my filestream access to allow the database to restore.

 

EXEC sp_configure 'filestream access level', '2'

RECONFIGURE

9/7/2008 12:39:58 PM (Eastern Daylight Time, UTC-04:00) |  | SQL Server 2008#
Search
Archive
Links
Categories
Admin Login
Sign In
Blogroll
 CTO 2.0
Antonio Chagoury
Dot NET Ramblings
Brian Noyes
 New Entry
 SharePoint Resources
Lamont Harrington
 Winsmarts
Sahil Malik
Themes
Pick a theme: