AdventureWorks 示例数据库AdventureWorks sample databases

06/16/2020

本文内容

适用于:Applies to: SQL ServerSQL Server(所有支持的版本)SQL ServerSQL Server (all supported versions) Azure SQL 数据库Azure SQL DatabaseAzure SQL 数据库Azure SQL Database Azure SQL 托管实例Azure SQL Managed InstanceAzure SQL 托管实例Azure SQL Managed Instance Azure Synapse AnalyticsAzure Synapse AnalyticsAzure Synapse AnalyticsAzure Synapse Analytics 并行数据仓库Parallel Data Warehouse并行数据仓库Parallel Data Warehouse适用于:Applies to: SQL ServerSQL Server(所有支持的版本)SQL ServerSQL Server (all supported versions) Azure SQL 数据库Azure SQL DatabaseAzure SQL 数据库Azure SQL Database Azure SQL 托管实例Azure SQL Managed InstanceAzure SQL 托管实例Azure SQL Managed Instance Azure Synapse AnalyticsAzure Synapse AnalyticsAzure Synapse AnalyticsAzure Synapse Analytics 并行数据仓库Parallel Data Warehouse并行数据仓库Parallel Data Warehouse

本文提供了下载 AdventureWorks 示例数据库的直接链接,以及用于将它们还原到 SQL Server 和 Azure SQL 数据库的说明。This article provides direct links to download AdventureWorks sample databases, as well as instructions for restoring them to SQL Server and Azure SQL Database.

有关示例的详细信息,请参阅 示例 GitHub 存储库。For more information about samples, see the Samples GitHub repository.

先决条件Prerequisites

下载备份文件Download backup files

使用以下链接下载适用于你的方案的相应示例数据库。Use these links to download the appropriate sample database for your scenario.

OLTP 数据适用于最典型的联机事务处理工作负荷。OLTP data is for most typical online transaction processing workloads.

数据 仓库 (DW) 数据用于数据仓库工作负荷。Data Warehouse (DW) data is for data warehousing workloads.

轻型 (LT) 数据是 OLTP 示例的轻型 pared 版本。Lightweight (LT) data is a lightweight and pared down version of the OLTP sample.

如果你不确定需要的内容,请从与你的 SQL Server 版本相匹配的 OLTP 版本开始。If you're not sure what you need, start with the OLTP version that matches your SQL Server version.

其他文件可直接在 GitHub 上找到:Additional files can be found directly on GitHub:

还原到 SQL ServerRestore to SQL Server

您可以使用该 .bak 文件将您的示例数据库还原到您的 SQL Server 实例中。You can use the .bak file to restore your sample database to your SQL Server instance. You can do so using the RESTORE (Transact-SQL) command, or using the graphical interface (GUI) in SQL Server Management Studio or Azure Data Studio.

如果不熟悉如何使用 SQL Server Management Studio (SSMS) ,可以参阅 连接 & 查询 开始使用。If you're not familiar using SQL Server Management Studio (SSMS), you can see connect & query to get started.

若要在 SQL Server Management Studio 中还原数据库,请执行以下步骤:To restore your database in SQL Server Management Studio, follow these steps:

.bak从 "下载备份文件" 部分中提供的链接之一下载相应的文件。Download the appropriate .bak file from one of links provided in the download backup files section.

将该 .bak 文件移动到 SQL Server 的备份位置。Move the .bak file to your SQL Server backup location. 这不同于安装位置、实例名称和 SQL Server 版本。This varies depending on your installation location, instance name and version of SQL Server. 例如,SQL Server 2019 的默认实例的默认位置是:For example, the default location for a default instance of SQL Server 2019 is:

C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup.C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup.

打开 SQL Server Management Studio (SSMS) 并连接到中的 SQL Server。Open SQL Server Management Studio (SSMS) and connect to your SQL Server in.

右键单击 对象资源管理器 > 还原数据库 ... "中的" 数据库 "以启动 还原数据库 向导。Right-click Databases in Object Explorer > Restore Database... to launch the Restore Database wizard.

选择 " 设备 ",然后选择省略号 ( ... ) 选择一个设备。Select Device and then select the ellipses (...) to choose a device.

选择 " 添加 ",然后选择 .bak 最近移动到此位置的文件。Select Add and then choose the .bak file you recently moved to this location. 如果你将文件移到此位置但无法在向导中看到它,则这通常表示权限问题 SQL Server 或登录 SQL Server 的用户无权在此文件夹中使用此文件。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.

选择 "确定" 以确认您的数据库备份选择,并关闭 " 选择备份设备 " 窗口。Select OK to confirm your database backup selection and close the Select backup devices window.

检查 " 文件 " 选项卡以确认 还原为 "位置",文件名与 " 还原数据库 向导" 中的预期位置和文件名匹配。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.

选择“确定”以还原数据库。Select OK to restore your database.

有关还原 SQL Server 数据库的详细信息,请参阅 使用 SSMS 还原数据库备份。For more information on restoring a SQL Server database, see Restore a database backup using SSMS.

您可以使用 Transact-sql (T-sql) 还原示例数据库。You can restore your sample database using Transact-SQL (T-SQL). 下面提供了还原 AdventureWorks2019 的示例,但数据库名称和安装文件路径可能因环境而异。An example to restore AdventureWorks2019 is provided below, but the database name and installation file path may vary depending on your environment.

若要将 AdventureWorks2019 还原到 Windows,请根据环境修改相应的值,然后运行以下 Transact-sql (t-sql) 命令:To restore AdventureWorks2019 to Windows, modify values as appropriate to your environment and then run the following Transact-SQL (T-SQL) command:

USE [master]

RESTORE DATABASE [AdventureWorks2019]

FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup\AdventureWorks2019.bak'

WITH FILE = 1, NOUNLOAD, STATS = 5

GO

若要将 AdventureWorks2019 还原到 linux,请将 Windows filesystem 路径更改为 linux,然后运行以下 Transact-sql (t-sql) 命令:To restore AdventureWorks2019 to Linux, change the Windows filesystem path to Linux, and then run the following Transact-SQL (T-SQL) command:

USE [master]

RESTORE DATABASE [AdventureWorks2019]

FROM DISK = '/var/opt/mssql/backup/AdventureWorks2019.bak'

WITH MOVE 'AdventureWorks2017' TO '/var/opt/mssql/data/AdventureWorks2019.mdf',

MOVE 'AdventureWorks2017_log' TO '/var/opt/mssql/data/AdventureWorks2019_log.ldf',

FILE = 1, NOUNLOAD, STATS = 5

GO

若要在 Azure Data Studio 中还原数据库,请执行以下步骤:To restore your database in Azure Data Studio, follow these steps:

.bak从 "下载备份文件" 部分中提供的链接之一下载相应的文件。Download the appropriate .bak file from one of links provided in the download backup files section.

将该 .bak 文件移动到 SQL Server 的备份位置。Move the .bak file to your SQL Server backup location. 这不同于安装位置、实例名称和 SQL Server 版本。This varies depending on your installation location, instance name and version of SQL Server. 例如,SQL Server 2019 的默认实例的默认位置是:For example, the default location for a default instance of SQL Server 2019 is:

C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup.C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup.

打开 Azure Data Studio Studio 并连接到 SQL Server 实例。Open Azure Data Studio Studio and connect to your SQL Server instance.

右键单击服务器,然后选择 " 管理"。Right-click on your server and select Manage.

选择 还原Select Restore

在 " 常规 " 选项卡上,填写 " 源" 下列出的值。On the General tab, fill in the values listed under Source.

在 " 还原自" 下,选择 " 备份文件"。Under Restore from, select Backup file.

在 " 备份文件路径" 下,选择存储 .bak 文件的位置。Under Backup file path, select the location you stored the .bak file.

这会自动填充其他字段,例如 数据库、 目标数据库 和 还原到。This auto-populates the rest of the fields such as Database, Target database and Restore to.

选择 " 还原 " 以还原数据库。Select Restore to restore your database.

部署到 Azure SQL 数据库Deploy to Azure SQL Database

可以通过两个选项查看示例 Azure SQL 数据库数据。You have two options to view sample Azure SQL Database data. 创建新数据库时,可以使用示例,或者可以使用 SQL Server Management Studio (SSMS) 将数据库从 SQL Server 直接部署到 Azure。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).

若要获取 Azure SQL 托管实例的示例数据,请参阅 将全球范围内的导入程序还原到 SQL 托管实例。To get sample data for Azure SQL Managed Instance instead, see restore World Wide Importers to SQL Managed Instance.

部署新的示例数据库Deploy new sample database

在 Azure SQL 数据库中创建新数据库时,可以选择创建空白数据库,也可以选择创建示例数据库。When you create a new database in Azure SQL Database, you have the option to create a blank database, or a sample database.

请按照以下步骤使用示例数据库创建新数据库:Follow these steps to use a sample database to create a new database:

连接到 Azure 门户。Connect to your Azure portal.

选择导航窗格左上角的 " 创建资源 "。Select Create a resource in the top left of the navigation pane.

选择 " 数据库 ",然后选择 " SQL 数据库"。Select Databases and then select SQL Database.

填写所需信息以创建数据库。Fill in the requested information to create your database.

在 " 其他设置 " 选项卡上,选择 " 示例 " 作为 " 数据源" 下的现有数据:On the Additional settings tab, choose Sample as the existing data under Data source:

选择 " 创建 " 以创建新的 SQL 数据库,这是 AdventureWorksLT 数据库的还原副本。Select Create to create your new SQL Database, which is the restored copy of the AdventureWorksLT database.

从 SQL Server 部署数据库Deploy database from SQL Server

SQL Server Management Studio 提供直接将数据库部署到 Azure SQL 数据库的功能。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.

若要将示例数据库从 SQL Server 部署到 Azure SQL 数据库,请执行以下步骤:To deploy a sample database from SQL Server to Azure SQL Database, follow these steps:

连接到 SQL Server Management Studio 中的 SQL Server。Connect to your SQL Server in SQL Server Management Studio.

右键单击还原的数据库 对象资源管理器 > 任务" > 将数据库部署到 Microsoft Azure SQL 数据库 ..."。Right-click your restored database in Object Explorer > Tasks > Deploy Database to Microsoft Azure SQL Database....

按照向导连接到 Azure SQL 数据库并部署数据库。Follow the wizard to connect to Azure SQL Database and deploy your database.

创建脚本Creation scripts

无需还原数据库,您也可以使用脚本来创建 AdventureWorks 数据库,而无需考虑版本。Instead of restoring a database, alternatively, you can use scripts to create the AdventureWorks databases regardless of version.

以下脚本可用于创建整个 AdventureWorks 数据库:The below scripts can be used to create the entire AdventureWorks database:

有关使用脚本的其他信息可在 GitHub上找到。Additional information about using the scripts can be found on GitHub.

后续步骤Next steps

恢复示例数据库后,请使用以下教程来开始使用 SQL Server:Once you've restored your sample database, using the following tutorials to get started with SQL Server:

adventureworks mysql_AdventureWorks 示例数据库相关推荐

  1. 安装SQL Server2008的示例数据库AdventureWorks 2008

    在安装SQL Server2008时,默认是不安装示例数据库的,如果要用到的话,就得自行下载相应的数据库,然后安装,当然,安装也还是要有一定的方法的,不然装不上. 1.检查安装环境,下载安装包 首先, ...

  2. 示例数据库 AdventureWorks 安装步骤

    安装 AdventureWorks 用备份文件安装 AdventureWorks 下载 AdventureWorks 将备份文件还原到 SQL Server 实例 用 T-SQL 脚本安装 Adven ...

  3. AdventureWorks、Northwind、pubs示例数据库下载

    用百度在网上找了好久都没有找到,后来谷歌一搜就找到正解了,阿弥陀佛-- 转自:http://www.cnblogs.com/stu-acer/archive/2009/03/25/1421889.ht ...

  4. 新SQL Server 2016示例数据库

    背景 (Background) We have all learned to love and hate the trusty Bike shop database. Almost every dem ...

  5. SQL Server 2008:示例数据库安装

    SQL Server 2008终于正式发布了,官方网站提供了SQL2008的下载试用,不过有一点不爽的就是他居然把X86,X64和IA64三种处理器的版本放在了同一个ISO中,我使用的是X86的操作系 ...

  6. 安装SQL2005示例数据库

    参考:SQL2005安装 AdventureWorks 示例数据库和示例 如果在初始安装 SQL  Server 2005 过程中没有安装示例数据库或示例,可以在以后安装. 从"添加或删除程 ...

  7. SQL Server On Linux(3)——SQL Server 2019 For Linux 下载并部署示例数据库

    本人新书上市,请多多关照:<SQL Server On Linux运维实战 2017版从入门到精通>   接上文SQL Server On Linux(2)--SQL Server 201 ...

  8. 通过备份导入SQLServer2017示例数据库

    通过备份导入SQLServer2017示例数据库 文章目录 通过备份导入SQLServer2017示例数据库 主要步骤 下载示例数据 将示例数据文件复制到相应文件夹 导入数据 主要步骤 下载示例数据 ...

  9. 安装SQL Server 2012示例数据库

    SQL Server的示例数据库是一个非常好的学习数据库的范例,在安装完SQL Server 2012后,默认情况下是不会安装示例数据库的,我们需要自己进行一些安装和设置. 安装Adventure W ...

  10. SqlServer示例数据库Northwind(一)——实体关系

    在学习Spss统计分析.EA画实体关系图.PowerDesigner画数据库模型图等时,苦于找不到一个好的实例.由于实际工作中项目使用的表结构属于公司的商业保密内容,且在和大家交流时,其结构大家也不熟 ...

最新文章

  1. 五、Elasticsearch中的API的简单使用(Python版本)
  2. windows环境下tensorflow安装过程详解(亲测安装成功后测试那块)
  3. 两个相邻盒子的边框怎么只显示一个_一篇文章带你快速理解盒子模型「经典案例」...
  4. 内部类详解————静态内部类
  5. Linux下 查找大文件
  6. 键是什么意思_化学提高不饱和键是什么意思
  7. caffe训练过程中的可视化
  8. 三相并网逆变器系统(光伏发电系统)simulink仿真
  9. 项目管理 - 常用英语词汇一
  10. FFmpeg切割视频,自定义视频ts片段时长
  11. 爱你穿越时间,两行来至秋末的眼泪
  12. 每一个都能笑抽的 39 个奇葩代码注释
  13. 无人货架上演生死时速,谁会成为最后的赢家?
  14. 《研发企业管理——思想、方法、流程和工具》——第1章 企业管理基本理念 1.1 企业的根本目标及其内涵...
  15. win10亮度无法调节
  16. 植物大战僵尸用户存档修改(CSDN任务1,20210418)
  17. 解决iOS下拉回弹方法二
  18. ​LeetCode刷题实战450:删除二叉搜索树中的节点
  19. 富文本中添加字体选项功能_扑中的字体功能
  20. 不得了了!刚刚腾讯官宣 Python 开发人才这样选

热门文章

  1. umijs有什么好处_umijs核心代码解读
  2. 菜鸟AJAX 教程和JSON
  3. 无刷直流电机计算转速
  4. 越狱开发笔记(三)——非越狱App砸壳
  5. 华为手机上的计算机怎么没了,华为手机怎么连接电脑 华为手机连接不上电脑怎么回事 华为手机连接USB没反应...
  6. Omron 论坛软件下载连接
  7. 基于STM32的高精度温度测控系统-PCB设计
  8. 【2021-02】实时获取百度搜索词接口
  9. 视频监控智能分析之火焰检测原理
  10. matlab在电磁波中的应用,MATLAB在电磁波与电磁场课程教学中的应用