How to Install Sample Databases in SQL Server 2008 R2

In this blog, we shall learn “How to install sample databases in SQL Server 2008 R2”. Sample databases are really helpful,  when you want to practice what you have learnt in SQL Server be it from a text book or an online article, blog etc sample databases are readily available to test. Knowing that it is easy to start from scratch on these sample databases makes you play with and even try some things that you would not want to do on other databases. Database and Log file shrinking (which is not suggested on user databases) but in order to learn such topics, your best choice is a sample database. With that lets focus on our goal (Installing the sample databases, if you have already forgotten…)

The first step is downloading the sample database. Visit the Microsoft Database Product Samples website and choose the sample database for the version that you want. Since we are dealing with SQL Server 2008 R2 he is the link. Once you have downloaded the file (approx 80 MB). Go to the location where the downloaded file is residing. Right click on the file AdventureWorks2008R2_SR1.exe (if you have not renamed it) and select Open; you can also double click on the file.

The exe file starts extracting to a temporary location on your local drive and once the extraction is done, the SQL Server 2008R2 SR1 Database Installer is displayed. The below screen is the first screen in which you have to accept to the license terms. Choose the check box and click Next.

In the next screen, it will displays on which database Instance the Sample databases will be added. If you have multiple instances on the machine, you can choose the Instance name from the drop down list.

Note that for some databases there are warning (yellow triangle with exclamation) icon being displayed, those databases cannot be installed through this installed but they can be added manually using Business Intelligence Developer Studio. You can click more information to find details on how to perform that task.

By default all sample databases that can be added, will be selected, you can un-check those databases that you would not want to install. Once you are done, click Install

The installation of sample databases progress is displayed, you can click Show Details button to view the detailed information in text format..

Once the installation is done, the progress bar indicates that installation is complete.. Click Finish to close the Installer.

Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru so that, you know when there is a new blog post.

— Bru Medishetty

Download SQL Server Sample Databases

When working with SQL Server most of the times the example queries that are provided in articles are based on the sample databases available in SQL Server 2005 / 2008.

If you have missed installing the Sample Databases when installing SQL Server, all you need to do is download the sample databases that are available at Microsoft Codeplex Website. There are databases available for SQL Server 2005 and SQL Server 2008.

Additionally you can look at the one of my articles to Install a sample Database in SQL Server 2005

— Bru Medishetty

Installing Sample Databases in SQL Server 2005

You can install sample Databases when Installing SQL Server Instance,  if that was not done, you need to install Sample Databases separately.

In this blog, we will look at the steps in doing that.

As the first step, download the Sample Database that would like to install, I chose AdventureWorks for SQL 2005 in this example.

You can follow this link to download the Sample Databases

Remember the path you downloaded the file to.

Browse the directory where you have downloaded the file, select the .msi file , right click and choose Install. (Picture Below)

The Installation process starts and we will look at each of those steps.

If the Security warning Dialog Box appears, choose Run. (Picture Below)

The welcome screen for the Installation Wizard is displayed, click Next. (Picture Below)

In the License Agreement Dialog, Choose I accept the terms to continue.

The Next Screen displays, the Destination Directory where the Sample Database would be installed to.
By default it will be Data Directory of SQL Server.  Click Next to continue and Install in the default Directory.

Click Install to begin the Installation.

When the Installation is completed, the below shown dialog Box is displayed and click Finish to complete the Installation.

Once you finish this step, you can check whether the Sample Database is installed by going to the Data Directory of your SQL Instance.

Both the Data and Log files are placed in the Data Directory of the SQL Server Instance by the installation that we performed.

Once this part is done, the next thing we have to do is open SQL Server Management Studio (SSMS). In the Object Explorer, Right click on the Databases Node and select Attach.

The attach databases dialog box appears and click Add Button.

When you click the Add button, there will be a window that requires us to locate the .MDF File. By default, it opens the Data Directory of the SQL Instance, so if the AdventureWorks Database Data File (.MDF) is available, select that .MDF File.

After the MDF file is chosen click OK, it will show the Attach Databases dialog box with the details of the MDF file and also the details of all the Database files (Both Data and Log)

Click OK to complete the attaching the Database.

Now you should be able to see the Database in the Databases Node in Object Explorer.

Do you like this site? Like our FB page @ Facebook.com\LearnSQLWithBru to know when there is new content.

— Bru Medishetty

http://learnsqlwithbru.com/images/Adventure10.jpg