1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00
Files
sql-server-samples/samples/databases/wide-world-importers/wwi-dw-database-scripts

Construct WideWorldImporters OLAP Database

The scripts in this folder are used to construct the WideWorldImportersDW database from scratch on SQL Server or Azure SQL Database.

A pre-created version of the database is available for download as part of the latest release of the sample: wide-world-importers-release.

Contents

About this sample
Before you begin
Run this sample
Disclaimers
Related links

About this sample

  1. Applies to: SQL Server 2016 (or higher), Azure SQL Database [testing and modified instructions are TBD]
  2. Key features: Core database features
  3. Workload: OLTP
  4. Programming Language: T-SQL
  5. Authors: Greg Low, Denzil Ribeiro, Jos de Bruijn
  6. Update history: 25 May 2016 - initial revision

Before you begin

To run this sample, you need the following prerequisites.

Software prerequisites:

  1. SQL Server 2016 (or higher) or an Azure SQL Database.
  2. SQL Server Management Studio, preferably 2016 April Preview or later (version >= 13.0.14000.36)

Run this sample

The below steps reconstruct the WideWorldImportersDW database. To construct the full version of the sample database (for Eval/Developer/Enterprise Edition and Azure SQL DB Premium), simply follow the steps below. To construct the standard edition version (for Standard Edition and Azure SQL DB Basic/Standard), omit step 6.

  1. Execute the script: 1-wwi-dw-metadata-population.sql -> this script creates the WWI_DW_Preparation database that holds all required metadata to create the OLAP database.

  2. Execute the script: 2-wwi-dw-construct-database-from-metadata-tables.sql -> this script performs code generation to create the script for the OLAP database.

  3. Copy the output from the execution of the previous script to a new query window and execute it. (A copy of this has been saved as 3-wwi-dw-recreate.sql) (If the database already existed, you will also see warnings related to it being removed and existing transactions rolled back).

  4. Execute the script: 4-wwi-dw-configured-required-database-objects.sql -> this script creates additional objects that are required that are not part of the table and schema metadata. This predominantly involves additional types, views, and stored procedures.

  5. Execute the script 5-wwi-dw-load-seed-data.sql. This script populates the seed data required for the database. It will typically take a few minutes to execute.

  6. Execute the script 6-wwi-dw-enable-full-features.sql. This script enables features not available in standard edition. Skip this step when creating the sample database targeting standard edition.

  7. Execute the WWI_Integration SSIS package to perform the ETL to populate the database. For details see [wwi-integration-etl] (../wwi-integration-etl/).

  8. Execute the script 8-wwi-dw-backup.sql. This creates a backup of the database. Make sure to adjust the file path of the backup to match your folder structure. (A sample restore script 9-wwi-restore.sql is also provided).

  9. If required, remove the WWI_DW_Preparation database.

Disclaimers

The code included in this sample is not intended to be used for production purposes.

TBD For more information, see these articles: