Skip to content

Commit 8262683

Browse files
committed
updates
1 parent 5c5adbc commit 8262683

File tree

1 file changed

+54
-13
lines changed

1 file changed

+54
-13
lines changed

samples/databases/adventure-works/README.md

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,64 @@
1-
# AdventureWorks Readme
1+
# AdventureWorks and AdventureWorksDW Readme
22

3-
The AdventureWorks databases are sample databases that were originally published for SQL Server 2008. There are two core sample databases. AdventureWorks is the OLTP sample, and AdventureWorksDW is the data warehouse sample. For some versions of SQL Server, there are additional releases that are intended as one-time only.
3+
The AdventureWorks databases are sample databases that were originally published for SQL Server 2008. AdventureWorks is the OLTP sample, and AdventureWorksDW is the data warehouse sample. For some versions of SQL Server, there are additional variations that are one-time only releases.
44

5-
Note that AdventureWorks has not seen any significant changes since the 2012 version. The only differences between the various versions of AdventureWorks are the name of the database and the database compatibility level. For a sample database leveraging more recent features of SQL Server, see [WideWorldImporters](../wide-world-importers/).
5+
The database tables are the same for all releases of SQL Server. However, the database compatibility level and version-specific information is different according to the version of SQL Server. Therefore, if you install AdventureWorks2014 on SQL Server 2016, the database will not be running at the compatibility level for SQL Server 2016. When this happens, new features in SQL Server might not work on the sample database.
66

7-
To install the AdventureWorks databases with the database compatibility level of your SQL Server instance, you can do use either install from a backup file or a script.
7+
To install the AdventureWorks databases with the database compatibility level of your SQL Server instance, you can install from a version-specific backup file or from the install script.
8+
9+
10+
## Install from a script
11+
12+
The install scripts create the sample database to have the database compatibility of your current version of SQL Server. Each script generates the version-specific information based on your current instance of SQL Server. This means you can use either the AdventureWorks or AdventureWorksDW install script on any version of SQL Server including CTPs, SPs, and interim releases.
13+
14+
15+
### To install AdventureWorks
16+
17+
1. Copy the GitHub data files and scripts for [AdventureWorks](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/adventure-works/oltp-install-script) to the C:\Samples\AdventureWorks folder on your local client.
18+
2. Or, [download AdventureWorks-oltp-install-script.zip](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks-oltp-install-script.zip) and extract the zip file to the C:\Samples\AdventureWorks folder.
19+
3. Open C:\Samples\AdventureWorks\instawdb.sql in SQL Server Management Studio and follow the instructions at the top of the file.
20+
21+
### To install AdventureWorksDW
22+
23+
1. Copy the GitHub data files and scripts for [AdventureWorksDW](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/adventure-works/data-warehouse-install-script) to the C:\Samples\AdventureWorksDW folder on your local client.
24+
2. Or, [download AdventureWorksDW-data-warehouse-install-script.zip](https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW-data-warehouse-install-script.zip) and extract the zip file to the C:\Samples\AdventureWorksDW folder.
25+
3. Open C:\Samples\AdventureWorksDW\instawdbdw.sql in SQL Server Management Studio and follow the instructions at the top of the file.
26+
27+
When installing from a script, the default database name is AdventureWorks or AdventureWorksDW. If you want the version added to the name, edit the database name at the beginning of the script.
828

929
## Install from a backup
1030

11-
For the complete set of downloads, see these releases:
31+
Download backup files from [AdventureWorks samples databases](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks) on GitHub.
1232

13-
- [AdventureWorks for Analysis Services](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks-analysis-services)
14-
- [AdventureWorks2016](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2016)
15-
- [AdventureWorks2014](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2014)
16-
- [AdventureWorks2012](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2012)
17-
- [AdventureWorks2008r2](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2008r2)
33+
You can install AdventureWorks or AdventureWorksDW by restoring a backup file. The backup files are version-specific. You can restore each backup to its respective version of SQL Server, or a later version.
1834

19-
## Install from a script
35+
For example, you can restore AdventureWorks2016 to SQL Server (starting with 2016). Regardless of whether AdventureWorks2016 is restored to SQL Server 2016, 2017, or a later version, the restored database has the database compatibility level of SQL Server 2016.
36+
37+
### To restore a database backup
38+
39+
1. Locate the Backup folder for your SQL Server instance. The default path for 64-bit SQL Server 2016 is C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup. The MSSQL value is MSSQL14 for SQL Server 2017, MSSQL13 for SQL Server 2016, MSSQL12 for SQL Server 2014, MSSQL11 for SQL Server 2012, and MSSQL10 for SQL Server 2008R2.
40+
2. Download the .bak file from [AdventureWorks release](https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks) and save it to the Backup folder for your SQL Server instance.
41+
3. Open SQL Server Management Studio and connect to your SQL Server instance.
42+
4. Restore the database using the SQL Server Management Studio user interface. For more information, see [Restore a database backup using SSMS](https://docs.microsoft.com/sql/relational-databases/backup-restore/restore-a-database-backup-using-ssms).
43+
5. Or, run the RESTORE DATABASE command in a new query Window.
44+
On the Standard toolbar, click the New Query button.
45+
5. Execute the following code in the query window. Note, the file paths in the scripts are the default paths. You may need to update the paths in the scripts to match your environment.
46+
47+
### Example T-SQL RESTORE DATABASE command
48+
49+
This example restores AdventureWorksDW2016 to SQL Server 2016. Note, the file paths are the default paths. If you use this example, you might need to update the paths in the scripts to match your environment.
50+
51+
```sql
52+
53+
USE [master]
54+
55+
RESTORE DATABASE AdventureWorksDW2016
56+
FROM disk= 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\AdventureWorksDW2016.bak'
57+
WITH MOVE 'AdventureWorksDW2016_data'
58+
TO 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2016.mdf',
59+
MOVE 'AdventureWorksDW2016_Log'
60+
TO 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\AdventureWorksDW2016.ldf'
61+
,REPLACE
2062

21-
To install **AdventureWorks**, copy the data files and scripts for [AdventureWorks](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/adventure-works/oltp-install-script) to your local client. Open [instawdb.sql](https://github.com/Microsoft/sql-server-samples/blob/master/samples/databases/adventure-works/oltp-install-script/instawdb.sql) in SQL Server Management Studio and follow the instructions at the top of the file.
63+
```
2264

23-
To install **AdventureWorksDW**, copy the data files and scripts for [AdventureWorksDW](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/adventure-works/data-warehouse-install-script) to your local client. Open [instawdbdw.sql](https://github.com/Microsoft/sql-server-samples/blob/master/samples/databases/adventure-works/oltp-install-script/instawdbdw.sql) in SQL Server Management Studio and follow the instructions at the top of the file.

0 commit comments

Comments
 (0)