背景 (Background)

We have all learned to love and hate the trusty Bike shop database. Almost every demo or presentation pertaining to SQL Server we do, we use the AdventureWorks sample database. Almost every code sample on books online references AdventureWorks for illustrations and practical explanations of a feature. When SQL Server 2005 was released Microsoft replaced the old Pubs & Northwind Sample databases with a more complete and more feature rich database called AdventureWorks. Ever since we have been using this new sample database for almost everything we want to test. Microsoft has now given us an even better sample database called WorldWideImporters, which utilises almost every SQL Server feature I can think of from Temporal Tables to In-Memory table.

我们都学会了爱与恨可信赖的自行车商店数据库。 几乎每个与SQL Server有关的演示或演示都使用AdventureWorks示例数据库。 联机丛书上的几乎所有代码示例都参考AdventureWorks,以获取功能的插图和实际说明。 当SQL Server 2005发布时,Microsoft用名为AdventureWorks的更完整,功能更丰富的数据库替换了旧的Pubs&Northwind Sample数据库。 自从我们一直将这个新的示例数据库用于几乎我们要测试的所有内容。 微软现在为我们提供了一个更好的示例数据库,称为WorldWideImporters,该数据库利用了我能想到的几乎所有SQL Server功能,从临时表到内存表。

讨论区 (Discussion)

When SQL Server 2016 was still in the CTP phases I wanted to play with all the new features and see what I can use it for in the “real world”. I know SQL Server always has this awesome new features, but I do not always have the resources or opportunities to play with this in a “real world” scenario. A good example of this is In-Memory tables, I know of them and I have created a few In-Memory tables in SIT to demonstrate the speed enhancements but it always gets turned down due to a concern of excessive memory usage.

当SQL Server 2016仍处于CTP阶段时,我想使用所有新功能,并了解如何在“现实世界”中使用它。 我知道SQL Server总是具有这些令人敬畏的新功能,但我并不总是有资源或机会在“现实世界”中使用它。 内存表就是一个很好的例子,我知道它们,并且在SIT中创建了一些内存表来演示速度的提高,但是由于担心过度使用内存,它总是被拒绝。

The new WorldWideImporters database offers us the ability to really test and play with all the new features as well as use it for simulations. The new sample database has and is still being built to be able to run new workloads. In other words, you can build a DataMart from WorlWideImporters and then simulate new workloads in the sample database which you can run daily. This means our data in our sample database is no longer static and can be changed whenever we need new data. This is exciting stuff because now I can brush up on my ASP skills and built web front ends and see how data changes would affect the performance of my application.

新的WorldWideImporters数据库使我们能够真正测试和使用所有新功能,并将其用于仿真。 新的示例数据库已经并且正在构建,以便能够运行新的工作负载。 换句话说,您可以从WorlWideImporters构建DataMart,然后在示例数据库中模拟新的工作负载,您可以每天运行这些工作负载。 这意味着我们样本数据库中的数据不再是静态的,可以在需要新数据时进行更改。 这是令人兴奋的事情,因为现在我可以提高ASP技能并构建Web前端,并查看数据更改将如何影响应用程序的性能。

I have added below an image of the database diagram for the new WorldWideImportes, as this is an ongoing project I am sure this will change in the near future. As you can see it is a nice complex database that we can use for development and testing.

我在下面添加了新的WorldWideImportes的数据库图的图像,因为这是一个正在进行的项目,我相信这会在不久的将来改变。 如您所见,它是一个很好的复杂数据库,可用于开发和测试。

注意事项 (Considerations)

I have found that running the initial data load script on my laptop as it stands in the git repository that I run out of memory on my laptop and the script fails, so I had to break it up into 2 parts.

我发现在笔记本电脑上运行初始数据加载脚本时,由于它位于git存储库中,导致笔记本电脑内存不足,并且脚本失败,因此我不得不将其分为两部分。

先决条件 (Prerequisites)

  1. Create a git account and download GitHub for desktop

    创建一个git帐户并下载GitHub桌面版

  2. SQL Server 2016 or Azure SQL Database v12+

    SQL Server 2016或Azure SQL数据库v12 +

目的 (Objective)

In this article, we will first fork and clone the SQL-server-samples repository and once this has been setup we will create and setup the WorldWideImporters sample database.

在本文中,我们将首先派生并克隆SQL-server-samples存储库,一旦安装完成,我们将创建并设置WorldWideImporters示例数据库。

解 (Solution)

Go to GitHub and create a new user account if you do not have one yet.

如果您还没有,请转到GitHub并创建一个新的用户帐户。

Once your user account is ready go and download GitHub for desktop.

准备好您的用户帐户后,请下载GitHub桌面版 。

Once the download is complete you can then just install the application by clicking next the whole time. You will be prompt to enter your user account details you have created earlier.

下载完成后,您可以单击整个时间,仅安装应用程序。 系统将提示您输入您先前创建的用户帐户详细信息。

Let’s start off with forking and cloning the SQL-server-samples repository. Go to SQL Server Samples Repository and click on “fork” on the top right-hand corner.

让我们从分叉和克隆SQL-server-samples存储库开始。 转到SQL Server Samples Repository ,然后单击右上角的“ fork”。

This will fork the repository and create a copy on your user profile, you can now copy the new URL in your browser. It should look something like https://github.com/Username/sql-server-samples .

这将派生存储库并在您的用户配置文件上创建一个副本,您现在可以在浏览器中复制新的URL。 它应该看起来像https://github.com/Username/sql-server-samples 。

Now open the Git Shell that was installed with Github Desktop and enter the following command

现在打开随Github Desktop一起安装的Git Shell,然后输入以下命令

git clone https://github.com/Username/sql-server-samples

(use your URL as this one is only for demonstration purposes). If everything is working according to plan you should see the following in the shell while it is busy cloning it to your local machine.

git clone https://github.com/Username/sql-server-samples

(使用您的URL,因为该URL仅用于演示目的)。 如果一切都按计划进行,那么当它正忙于将其克隆到本地计算机时,您应该在外壳中看到以下内容。

Once this is completed we now have all the code we need to continue with creating and setting up the WorldWideImporters sample database.

完成此操作后,我们便拥有了继续创建和设置WorldWideImporters示例数据库所需的所有代码。

Now it is time to open our trusty SSMS and start creating the database. All of the scripts that we are going to use for this exercise is located now in your development directory that you specified in GitHub Desktop, by default it is in your “My Documents” ~\sql-server-samples\samples\databases\wide-world-importers\wwi-database-scripts . There are 9 scripts that we will use to create the Sample database.

现在是时候打开我们值得信赖的SSMS并开始创建数据库了。 现在,我们将用于此练习的所有脚本都位于您在GitHub Desktop中指定的开发目录中,默认情况下,它位于“我的文档”中〜\ sql-server-samples \ samples \ databases \ wide -world-importers \ wwi-database-scripts。 我们将使用9个脚本来创建示例数据库。

The first script that we need to run is “1-wwi-metadata-population.sql” this prepares the metadata for the sample database and just assist with the final creations and recreation of the database. Microsoft has provided us with a script to do this straight of the bat, but we will have to change a few thing in the script for it to run and thus we will not be going this route in this article.

我们需要运行的第一个脚本是“ 1-wwi-metadata-population.sql”,该脚本将为示例数据库准备元数据,并且仅辅助最终创建和重新创建数据库。 Microsoft为我们提供了一个脚本来完成此任务,但是我们将不得不在脚本中进行一些更改才能使其运行,因此在本文中我们不会采用这种方式。

We can just run this script without changing anything, this will create the WWI_Preparation database that contains all of the metadata for WorldWideImporters everything from schemas to indexes.

我们可以直接运行此脚本而无需进行任何更改,这将创建WWI_Preparation数据库,其中包含WorldWideImporters的所有元数据,从模式到索引。

Once the preparation database is completed we can now run “2-wwi-construct-database-from-metadata-tables” script. This will generate an sql script that you can use to create or re-create the WorldWideImporters database.

准备数据库完成后,我们现在可以运行“ 2-wwi-construct-database-from-metadata-tables”脚本。 这将生成一个sql脚本,可用于创建或重新创建WorldWideImporters数据库。

We can just copy the output into a new window and execute, this will then create the Sample database for use. You can re-run this anytime you want to start fresh.

我们可以将输出复制到新窗口中并执行,然后将创建Sample数据库供使用。 您可以随时重新开始运行。

Now that we have our sample database up and running, we need to configure some of the required objects for the workloads. Luckily Microsoft has provided us with a script that does this for us “4-wwi-configure-required-database-objects.sql”. We can just open this script and press execute.

现在我们的示例数据库已启动并正在运行,我们需要为工作负载配置一些必需的对象。 幸运的是,Microsoft为我们提供了一个脚本,可以为我们执行“ 4-wwi-configure-required-database-objects.sql”。 我们可以打开此脚本,然后按执行。

We now have the schema ready and can now start with loading some data into the sample database, we can do this by running the following script “5-wwi-load-seed-data.sql”. I have found that on my laptop I had to break the script up into smaller chunks for it to execute successfully as my laptop did not enjoy the large transactions.

现在我们已经准备好模式,现在可以从将一些数据加载到示例数据库中开始,我们可以通过运行以下脚本“ 5-wwi-load-seed-data.sql”来实现。 我发现在我的笔记本电脑上,我不得不将脚本分成较小的块,以便脚本能够成功执行,因为我的笔记本电脑无法进行大量交易。

Once we have our data ready we can run a data simulation from the following script “6-wwi-data-simulation.sql”

一旦我们准备好数据,就可以从以下脚本“ 6-wwi-data-simulation.sql”运行数据模拟。

Please note this does take some time, so now is a good time to go and refill your coffee cup.

请注意,这确实需要一些时间,因此现在是时候为咖啡杯加注了。

We do have a script that will enable the full features “7-wwi-enable-full-features.sql”, but take note that you can only run this if you are using SQL Server 2016 Enterprise or Developer Edition.

我们确实有一个脚本将启用全部功能“ 7-wwi-enable-full-features.sql”,但请注意,只有在使用SQL Server 2016 Enterprise或Developer Edition时,您才能运行此脚本。

If you are happy, you can now create a backup of our new sample database, by either doing this manual or just running one of the scripts Microsoft has provided us” 8-wwi-backup.sql”.

如果您满意,现在可以通过执行本手册或仅运行Microsoft提供给我们的“ 8-wwi-backup.sql”脚本之一来创建新示例数据库的备份。

We are now done, and can start to convert our demos to the new Sample database

我们现在完成了,可以开始将演示转换为新的Sample数据库。

最后的想法 (Final Thoughts)

I am truly impressed with the flexibility or the new sample database Microsoft has released. I found that you can enable Enterprise functionality later when you want to test more of the SQL Server 2016 functionality. I will write more articles on how to run the sample workloads and really put SQL Server and its new functions to the test. I know from the repository you can create and load an Analytics database (DataMart), but I think it would be more fun to try and create on for yourself.

微软发布的灵活性或新的示例数据库给我留下了深刻的印象。 我发现,当您想测试更多SQL Server 2016功能时,可以在以后启用企业功能。 我将撰写更多有关如何运行示例工作负载以及如何将SQL Server及其新功能进行测试的文章。 我知道您可以从存储库中创建和加载Analytics数据库(DataMart),但是尝试自己创建将更有趣。

I also believe that Microsoft will start changing the book online code samples to reference the new sample database for better demonstration purposes.

我还相信,Microsoft将开始更改在线书籍代码示例,以引用新的示例数据库,以更好地进行演示。

翻译自: https://www.sqlshack.com/new-sql-server-2016-sample-database/

新SQL Server 2016示例数据库相关推荐

  1. SQL Server 2016 [修改数据库名称]及[添加次文件和日志文件]

     1.教程实例:  SQL Server 2016 [修改数据库名称] 源代码: -- 更改要修改的数据库名称 alter database DB2--修改为新的数据库名称 modify name=D ...

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

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

  3. SQL Server 2016还原数据库

    1:使用SQL Server 2016管理工具,连接到服务器. 2:右键数据库,选择还原数据库. 3:在设备中找到备份的文件进行还原.目标数据库可以起个新名称. 4:点击文件,更改master和mas ...

  4. SQL Server 2016完整数据库备份的演练

    Every DBA, even a beginner, may walk through the SQL Server backup screen multiple times per day. It ...

  5. 如何在SQL Server 2016中比较查询执行计划

    SQL Server 2016 provides great enhancement capability features for troubleshooting purposes. Some of ...

  6. SQL Server 2016中的新PowerShell Cmdlet

    介绍 (Introduction) PowerShell is Windows Shell that can be used to automate tasks in Windows, Exchang ...

  7. SQL Server 2016的新功能–动态数据屏蔽

    There are many new features in SQL Server 2016, but the one we will focus on in this post is: SQL Se ...

  8. SQL Server 2016新特性:列存储索引新特性

    SQL Server 2016新特性:列存储索引新特性 行存储表可以有一个可更新的列存储索引,之前非聚集的列存储索引是只读的. 非聚集的列存储索引支持筛选条件. 在内存优化表中可以有一个列存储索引,可 ...

  9. SQL Server 2016 新功能之综述

    冬去春来,发现之前最后一篇写在2012年,又过去了5年了,时间如飞啊.那时候SQL 2012 发布让人兴奋了一把,哪知道时间如刀,刀刀催人老啊,今天SQL 2016都发布了很久了,很快SQL On l ...

最新文章

  1. Big Data Security Part One: Introducing PacketPig
  2. C++类为什么使用private?------封装性
  3. linux下字符编码转换
  4. ctr 平滑_预算平滑技术在58商业的探索与实践
  5. Fabio技术手册(1):概述和快速上手
  6. JPA入门简介与搭建HelloWorld(附代码下载)
  7. python3默认编码_python3的url编码和解码,自定义gbk、utf-8的例子
  8. Python_sklearn_回归
  9. 原创 TypeScript入门教程 之  迭代器
  10. DHTML中window的使用
  11. sklearn学习笔记之简单线性回归
  12. office communications server 2007 标准版部署详细步骤及错误分析
  13. 在线直播系统网站源码搭建一个点播跟直播流媒体服务器
  14. 宋宝华:公元1024年Linux内核的尘封往事
  15. 局域网文件传输方式分析
  16. dell计算机环境温度,戴尔桌面使用和维护的考虑.doc
  17. “某某云词典” – 纠结的初体验
  18. dhcp服务器是如何进行租约信息的更新的,DHCP服务器
  19. 嵌入式Linux系统协议栈,嵌入式linux tcpip协议栈概述
  20. 机器学习(六)--------python实现朴素贝叶斯对email分类

热门文章

  1. linux java 1.6 下载地址_linux 安装配置java环境 jdk1.6 jdk-6u45-linux-x64.bin
  2. .NET CORE+CENTOS部署+supervisor守护
  3. 查看Oracle表中的指定记录在数据文件中的位置
  4. RSA3:预提取数据
  5. Comet杀人游戏开发日志-1(问题记录-于核心功能测试成功转向实际开发阶段)
  6. ASP.NET MVC+LINQ开发一个图书销售站点(6):创建数据层
  7. LeetCode(21)——合并两个有序链表(JavaScript)
  8. 计算机网络---网络层ARP协议
  9. 数据库原理—数据、数据库(一)
  10. 用C#连接到数据库实现学生学籍管理系统