Skip to content

Commit 361bb5d

Browse files
committed
Samples CSAT ORK (AzB 1703117)
1 parent 0e9b9dc commit 361bb5d

6 files changed

Lines changed: 132 additions & 59 deletions

File tree

Lines changed: 128 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: "Install and configure AdventureWorks sample database"
3-
description: Follow these instructions to download and install AdventureWorks sample databases with SQL Server Management Studio or in Azure SQL Database.
2+
title: "AdventureWorks sample databases"
3+
description: Follow these instructions to download and install AdventureWorks sample databases to SQL Server or Azure SQL Database.
44
ms.prod: sql
55
ms.prod_service: sql
66
ms.technology: samples
7-
ms.date: "06/19/2018"
7+
ms.date: "06/16/2020"
88
ms.reviewer: ""
99
ms.topic: conceptual
1010
author: MashaMSFT
@@ -14,87 +14,162 @@ ms.custom: "seo-lt-2019"
1414
# AdventureWorks installation and configuration
1515
[!INCLUDE[appliesto-ss-asdb-asdw-pdw-md](../includes/appliesto-ss-asdb-asdw-pdw-md.md)]
1616

17-
AdventureWorks download links and installation instructions.
17+
This article provides direct links to download AdventureWorks sample databases, as well as instructions for restoring them to SQL Server and Azure SQL Database.
18+
19+
For more information about samples, see the [Samples GitHub repository](https://github.com/microsoft/sql-server-samples/tree/master/samples/databases).
1820

1921
## Prerequisites
2022

21-
- [SQL Server](https://www.microsoft.com/evalcenter/evaluate-sql-server-2016) or [Azure SQL Database](https://azure.microsoft.com/services/sql-database/). For the Full version of the sample, use SQL Server Evaluation/Developer/Enterprise Edition.
22-
- [SQL Server Management Studio](../ssms/download-sql-server-management-studio-ssms.md). For the best results use the June 2016 release or later.
23-
24-
## OLTP downloads
23+
- [SQL Server](https://www.microsoft.com/evalcenter/evaluate-sql-server-2019) or [Azure SQL Database](https://azure.microsoft.com/services/sql-database/).
24+
- [SQL Server Management Studio](../ssms/download-sql-server-management-studio-ssms.md) or [Azure Data Studio](../azure-data-studio/download-azure-data-studio.md). or later.
2525

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

28-
- [AdventureWorks2017.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2017.bak)
29-
- [AdventureWorks2016.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2016.bak)
30-
- [AdventureWorks2014.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2014.bak)
31-
- [AdventureWorks2012.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2012.bak)
32-
- [AdventureWorks2008R2.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks2008r2/adventure-works-2008r2-oltp.bak)
27+
## Download .bak files
3328

29+
Use these links to download the appropriate sample database for your scenario.
3430

35-
## Data Warehouse downloads
31+
- **OLTP** data is for most typical online transaction processing workloads.
32+
- **Data Warehouse (DW)** data is for data warehousing workloads.
33+
- **Lightweight (LT)** data is a lightweight and pared down version of the **OLTP** sample.
3634

37-
Direct links to the Data Warehouse versions of AdventureWorks can be found below:
35+
|**OLTP** |D**ata Warehouse** |**Lightweight**|
36+
|---------|---------|---------|
37+
|[AdventureWorks2019.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2019.bak)|[AdventureWorksDW2019.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2019.bak)|[AdventureWorksLT2019.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksLT2019.bak)|
38+
|[AdventureWorks2017.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2017.bak)|[AdventureWorksDW2017.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2017.bak)|[AdventureWorksLT2017.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksLT2017.bak)|
39+
|[AdventureWorks2016.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2016.bak)|[AdventureWorksDW2016.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2016.bak)|[AdventureWorksLT2016.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksLT2016.bak)|
40+
|[AdventureWorks2016_EXT.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2016_EXT.bak)|[AdventureWorksDW2016_EXT.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2016_EXT.bak)| N/A |
41+
|[AdventureWorks2014.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2014.bak)|[AdventureWorksDW2014.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2014.bak)|[AdventureWorksLT2014.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksLT2014.bak)|
42+
|[AdventureWorks2012.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2012.bak)|[AdventureWorksDW2012.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2012.bak)|[AdventureWorksLT2012.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksLT2012.bak)|
43+
|[AdventureWorks2008R2.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks2008r2/adventure-works-2008r2-oltp.bak)| [AdventureWorksDW2008R2.bak](https://github.com/microsoft/sql-server-samples/releases/download/adventureworks2008r2/adventure-works-2008r2-dw.bak) | N/A |
3844

39-
- [AdventureWorksDW2017.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2017.bak)
40-
- [AdventureWorksDW2016.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2016.bak)
41-
- [AdventureWorksDW2014.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2014.bak)
42-
- [AdventureWorksDW2012.bak](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2012.bak)
43-
- [AdventureWorksDW2008R2.bak](https://github.com/microsoft/sql-server-samples/releases/download/adventureworks2008r2/adventure-works-2008r2-dw.bak)
45+
Additional files can be found directly on GitHub:
4446

45-
## Creation scripts
46-
The below scripts can be used to create the entire AdventureWorks database, irrespective of version.
47+
- [SQL Server 2014 - 2019](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks)
48+
- [SQL Server 2012](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2012)
49+
- [SQL Server 2008 and 2008R2](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2008r2)
4750

48-
- [AdventureWorks OLTP Scripts Zip](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks-oltp-install-script.zip)
49-
- [AdventureWorks DW Scripts Zip](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW-data-warehouse-install-script.zip)
5051

51-
## GitHub links
52+
## Restore to SQL Server
53+
54+
You can use the `.bak` file to restore your sample database to your SQL Server instance. You can do so using the graphical interface (GUI) in [SQL Server Management Studio](../ssms/download-sql-server-management-studio-ssms.md) or [Azure Data Studio](../azure-data-studio/download-azure-data-studio.md), or using the [RESTORE (Transact-SQL)](../t-sql/statements/restore-statements-transact-sql.md) command.
55+
56+
### GUI
57+
58+
You can restore your database using the GUI in SQL Server Management Studio or Azure Data Studio.
59+
60+
# [SQL Server Management Studio (SSMS)](#tab/ssms)
61+
62+
If you're not familiar using SQL Server Management Studio (SSMS), you can see [connect & query](../ssms/tutorials/connect-query-sql-server.md) to get started.
63+
64+
To restore your database in SQL Server Management Studio, follow these steps:
65+
66+
1. Download the appropriate `.bak` file from one of links provided in the [.bak download files](#download-bak-files) section.
67+
1. Move the `.bak` file to your SQL Server backup location. This varies depending on your installation location, instance name and version of SQL Server. The default location for a default instance of SQL Server 2019 is `C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup`.
68+
1. Open SQL Server Management Studio (SSMS) and connect to your SQL Server.
69+
1. Right-click **Databases** in **Object Explorer** > **Restore Database...** to launch the **Restore Database** wizard.
5270

53-
- [All AdventureWorks files for SQL 2014 - 2016](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks)
54-
- [All AdventureWorks files for SQL 2012](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2012)
55-
- [All AdventureWorks files for SQL 2008 and 2008R2](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2008r2)
71+
:::image type="content" source="media/adventureworks-install-configure/restore-db-ssms.png" alt-text="Choose to restore your database by right-clicking databases in Object Explorer and then selecting Restore Database":::
5672

57-
## Install to SQL Server
5873

59-
### Restore backup
60-
Follow the below steps to restore a backup of your database using SQL Server Management Studio.
74+
1. Select **Device** and then select the ellipses **(...)** to choose a device.
75+
1. Select **Add** and then choose the `.bak` file you recently moved to this location. If you moved your file to this location but you're not able to see it in the wizard, this typically indicates a permissions issue - SQL Server or the user signed into SQL Server does not have permission to this file in this folder.
76+
1. Select **OK** to confirm your database backup selection and close the **Select backup devices** window.
77+
1. Check the **Files** tab to confirm the **Restore as** location and file names match your intended location and file names in the **Restore Database** wizard.
78+
1. Select **OK** to restore your database.
6179

62-
1. Open SQL Server Management Studio and connect to the target SQL Server instance.
63-
2. Right-click on the **Databases** node, and select **Restore Database**.
64-
3. Select **Device** and click the ellipses (**...**)
65-
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**.
66-
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.
67-
6. Click **OK**. This will initiate the database restore. After it completes, you will have the AdventureWorks database installed on your SQL Server instance.
80+
:::image type="content" source="media/adventureworks-install-configure/restore-db-wizard-ssms.png" alt-text="Choose to restore your database by right-clicking databases in Object Explorer and then selecting Restore Database":::
6881

6982
For more information on restoring a SQL Server database, see [Restore a database backup using SSMS](../relational-databases/backup-restore/restore-a-database-backup-using-ssms.md).
7083

84+
# [Azure Data Studio](#tab/data-studio)
85+
86+
If you're not familiar using Azure Data Studio, you can see [connect & query](../azure-data-studio/quickstart-sql-server.md) to get started
87+
88+
To restore your database in Azure Data Studio (SSMS), follow these steps:
89+
90+
1. Download the appropriate `.bak` file from one of links provided in the [.bak download files](#download-bak-files) section.
91+
1. Move the `.bak` file to your SQL Server backup location. This varies depending on your installation location, instance name and version of SQL Server. The default location for a default instance of SQL Server 2019 is `C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup`.
92+
1. Open Azure Data Studio Studio (SSMS) and connect to your SQL Server.
93+
1. Right-click **Databases** in **?????** > **Restore** to launch the **?????** wizard.
94+
95+
:::image type="content" source="media/adventureworks-install-configure/restore-db-ssms.png" alt-text="Choose to restore your database by right-clicking databases in Object Explorer and then selecting Restore Database":::
96+
97+
1. ???????????
98+
1. ???????????
99+
1. ??????????????
100+
1. Check the **Files** tab to confirm the **Restore as** location and file names match your intended location and file names in the **Restore Database** wizard.
101+
1. Select **OK** to restore your database.
102+
103+
:::image type="content" source="media/adventureworks-install-configure/restore-db-wizard-ssms.png" alt-text="Choose to restore your database by right-clicking databases in Object Explorer and then selecting Restore Database":::
104+
105+
---
106+
107+
### Transact-SQL (T-SQL)
108+
109+
You can restore your sample database using Transact-SQL (T-SQL) as well. An example to restore AdventureWorks2019 is provided below, but the database name and installation file path may vary depending on your environment.
110+
111+
To restore AdventureWorks2019, modify values as appropriate to your environment and then run the following Transact-SQL (T-SQL) command:
71112

72-
### Attach a datafile
73-
Follow the below steps to attach the datafile for your database using SQL Server Management Studio.
113+
```sql
114+
USE [master]
115+
RESTORE DATABASE [AdventureWorks2019]
116+
FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup\AdventureWorks2019.bak'
117+
WITH FILE = 1, NOUNLOAD, STATS = 5
118+
GO
74119

75-
1. Open SQL Server Management Studio and connect to the target SQL Server instance.
76-
2. Right-click on the **Databases** node, and select **Attach**.
77-
3. Select **Add** and navigate to the .MDF file you want to attach.
78-
1. Select the file and click **OK**.
79-
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.
80-
1. 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.
81-
1. Select **OK** to attach the file. After the file is attached, you will have the AdventureWorks database installed on your SQL Server instance.
120+
```
82121

83-
For more information on attaching database files, see [Attach a database](../relational-databases/databases/attach-a-database.md).
122+
## Deploy to Azure SQL Database
84123

85-
## Install to Azure SQL Database
124+
You have two options to view sample Azure SQL Database data. You can use a sample when you create a new database, or you can deploy a database from SQL Server directly to Azure using SQL Server Management Studio (SSMS).
86125

126+
To get sample data for Azure SQL Managed Instance instead, see [restore World Wide Importers to SQL Managed Instance](/azure/azure-sql/managed-instance/restore-sample-database-quickstart).
87127

88-
If you do not yet have a SQL Server in Azure, navigate to the [Azure portal](https://portal.azure.com/) and create a new SQL Database. In the process of creating a database, you will create a server. Make note of the server. See [this tutorial](https://azure.microsoft.com/documentation/articles/sql-database-get-started/) to create a database in minutes.
128+
### Deploy new sample database
129+
130+
When you create a new database in Azure SQL Database, you have the option to create a blank database, or a sample database.
131+
132+
Follow these steps to use a sample database to create a new database:
89133

90134
1. Connect to your Azure portal.
91135
1. Select **Create a resource** in the top left of the navigation pane.
92136
1. Select **Databases** and then select **SQL Database**.
93-
1. Fill in the requested information.
94-
1. In the **Select Source** field, select **Sample (AdventureWorksLT)** to restore a backup of the latest AdventureWorksLT backup.
137+
1. Fill in the requested information to create your database.
138+
1. On the **Additional settings** tab, choose **Sample** as the existing data under **Data source**:
139+
140+
:::image type="content" source="media/adventureworks-install-configure/deploy-sample-to-azure.png" alt-text="Choose sample as the data source on the Additional settings tab in the Azure portal when creating your Azure SQL Database":::
141+
95142
1. Select **Create** to create your new SQL Database, which is the restored copy of the AdventureWorksLT database.
96143

97144

98-
## See also
145+
### Deploy database from SQL Server
146+
147+
SQL Server Management Studio provides the ability to deploy a database directly to Azure SQL Database. This method does not currently provide data validation so is intended for development and testing and should not be used for production.
148+
149+
To deploy a sample database from SQL Server to Azure SQL Database, follow these steps:
150+
151+
1. Connect to your SQL Server in SQL Server Management Studio.
152+
1. If you haven't already done so, [restore the sample database to SQL Server](#restore-to-sql-server).
153+
1. Right-click your restored database > **Tasks** > **Deploy Database to Microsoft Azure SQL Database...**.
154+
155+
:::image type="content" source="media/adventureworks-install-configure/deploy-db-to-azure.png" alt-text="Choose to deploy your database to Microsoft Azure SQL Database from right-clicking your database and selecting Tasks":::
156+
157+
1. Follow the wizard to connect to your Azure SQL Database and deploy your database.
158+
159+
160+
## Creation scripts
161+
162+
Instead of restoring a database, alternatively, you can use scripts to create the AdventureWorks databases regardless of version.
163+
164+
The below scripts can be used to create the entire AdventureWorks database:
165+
166+
- [AdventureWorks OLTP Scripts Zip](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks-oltp-install-script.zip)
167+
- [AdventureWorks DW Scripts Zip](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW-data-warehouse-install-script.zip)
168+
169+
170+
## Next steps
171+
172+
Once you have your sample databases restored, the following tutorials can help you get started with SQL Server:
173+
99174
[Tutorials for SQL Server Management Studio](../ssms/tutorials/tutorial-sql-server-management-studio.md)
100175
[Tutorials for SQL Server database engine](../relational-databases/database-engine-tutorials.md)
55 KB
Loading
33.8 KB
Loading
22.8 KB
Loading
34.2 KB
Loading

docs/toc.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10098,14 +10098,10 @@
1009810098
items:
1009910099
- name: Database samples
1010010100
items:
10101-
- name: Samples Overview
10101+
- name: Overview
1010210102
href: samples/sql-samples-where-are.md
10103-
- name: All GitHub Samples >>
10104-
href: https://github.com/Microsoft/sql-server-samples/tree/master/samples
1010510103
- name: AdventureWorks
10106-
items:
10107-
- name: Install & configure
10108-
href: samples/adventureworks-install-configure.md
10104+
href: samples/adventureworks-install-configure.md
1010910105
- name: Wide World Importers
1011010106
items:
1011110107
- name: Overview
@@ -10130,6 +10126,8 @@
1013010126
href: samples/wide-world-importers-generate-data.md
1013110127
- name: ETL workflow
1013210128
href: samples/wide-world-importers-perform-etl.md
10129+
- name: All GitHub Samples >>
10130+
href: https://github.com/Microsoft/sql-server-samples/tree/master/samples
1013310131
- name: Errors & events
1013410132
href: relational-databases/errors-events/errors-and-events-reference-database-engine.md
1013510133
items:

0 commit comments

Comments
 (0)