AdventureWorks Installation and configuration

APPLIES TO: yesSQL Server yesAzure SQL Database yesAzure SQL Data Warehouse yesParallel Data Warehouse

AdventureWorks download links and installation instructions.

Prerequisites

OLTP downloads

Direct links to the OLTP versions of AdventureWorks can be found below:

Data Warehouse downloads

Direct links to the Data Warehouse versions of AdventureWorks can be found below:

Creation scripts

The below scripts can be used to create the entire AdventureWorks database, irrespective of version.

Install to SQL Server

Restore backup

Follow the below steps to restore a backup of your database using SQL Server Management Studio.

  1. Open SQL Server Management Studio and connect to the target SQL Server instance.
  2. Right-click on the Databases node, and select Restore Database.
  3. Select Device and click the ellipses (...)
  4. In the dialog Select backup devices, click Add, navigate to the database backup in the filesystem of the server, and select the backup. Click OK.
  5. If needed, change the target location for the data and log files, in the Files pane. Note that it is best practice to place data and log files on different drives.
  6. Click OK. This will initiate the database restore. After it completes, you will have the AdventureWorks database installed on your SQL Server instance.

For more information on restoring a SQL Server database, see Restore a database backup using SSMS.

Attach a datafile

Follow the below steps to attach the datafile for your database using SQL Server Management Studio.

  1. Open SQL Server Management Studio and connect to the target SQL Server instance.
  2. Right-click on the Databases node, and select Attach.
  3. Select Add and navigate to the .MDF file you want to attach.
  4. Select the file and click OK.
    1. The database you selected should be displayed in the bottom window. If the file is listed as "not found", select the ellipses (...) next to the file name and update the path to the correct path.
    2. If you only have the data file (.mdf), and not the log file (.ldf), then highlight the .ldf in the bottom window and select Remove. This will create a new log file.
  5. Select OK to attach the file. After the file is attached, you will have the AdventureWorks database installed on your SQL Server instance.

For more information on attaching database files, see Attach a database.

Install to Azure SQL Database

If you do not yet have a SQL Server in Azure, navigate to the Azure portal and create a new SQL Database. In the process of create a database, you will create a server. Make note of the server. See this tutorial to create a database in minutes.

  1. Connect to your Azure portal.
  2. Select Create a resource in the top left of the navigation pane.
  3. Select Databases and then select SQL Database.
  4. Fill in the requested information.
  5. In the Select Source field, select Sample (AdventureWorksLT) to restore a backup of the latest AdventureWorksLT backup.
  6. Select Create to create your new SQL Database, which is the restored copy of the AdventureWorksLT database.

See also

Tutorials for SQL Server Management Studio Tutorials for SQL Server database engine