Published on

February 9, 2022

How to Install AdventureWorks Database on SQL Server

Microsoft offers a variety of sample databases that can be installed on test instances, and one of the most popular ones is the AdventureWorks database. This sample database is available for different workload types, such as OLTP, Data Warehouse, and Lightweight workloads. In this tutorial, we will guide you through the steps to install the AdventureWorks database on your SQL Server instance.

Using Scripts

There are two ways to install the AdventureWorks database: using scripts or restoring a backup file. Let’s start with the script approach.

  1. First, download the AdventureWorks sample database scripts from the official Microsoft website.
  2. Extract the downloaded zip file and locate the master T-SQL script file.
  3. Before running the script, make sure that Full Text Search is installed on your SQL Server instance if you want to use this feature.
  4. Store all the downloaded files and scripts in a specific location on your machine.
  5. Launch SQL Server Management Studio (SSMS) and connect to your SQL Server instance.
  6. Open the master T-SQL script file in SSMS.
  7. Enable SQLCMD mode in SSMS by going to the “Query” menu and clicking on “SQLCMD Mode”.
  8. Execute the script by pressing F5.
  9. Observe the output to see the objects being created, such as tables, full-text catalogs, and indexes.
  10. Once the script completes, refresh the Databases folder in SSMS to see the newly created AdventureWorks database.

Restoring the Backup File

If you prefer to install the AdventureWorks database by restoring a backup file, follow these steps:

  1. Download the AdventureWorks backup file from the official Microsoft website or from GitHub.
  2. Launch SSMS and connect to your SQL Server instance.
  3. Right-click on “Databases” and select “Restore Database…”.
  4. In the Restore Database window, choose the backup file by clicking on the Device radio button and selecting the file.
  5. Verify the database files and paths in the “Files” tab.
  6. Click OK to start the restore process.
  7. Once the restore is complete, you can start using the AdventureWorks database.

That’s it! You have successfully installed the AdventureWorks database on your SQL Server instance. Whether you choose to use scripts or restore a backup file, AdventureWorks provides a valuable resource for testing and learning SQL Server.

Article Last Updated: 2021-06-18

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.