Often as consultants, we don’t get to work onsite alongside our clients instead we are given copies of clients’ production environment and work on proposed solutions back at our offices. Once development has been completed, we then deploy and integrate our solution back to the client’s production environment. I’ve recently had to adopt a similar offsite development approach whilst working on a project that included development and configuration of master data services. In this article, I will demonstrate how a SQL Server 2017 Master Data Services (MDS) model can be exported from one environment (i.e. MDS Dev) and deployed into another environment (i.e. MDS Prod).

通常,作为顾问,我们不需要与客户一起在现场工作,而是获得客户生产环境的副本,并在我们的办公室工作以提出建议的解决方案。 一旦开发完成,我们便将解决方案部署并集成回客户的生产环境。 我最近在从事一个包含主数据服务的开发和配置的项目时,不得不采用类似的异地开发方法。 在本文中,我将演示如何从一个环境(即MDS Dev)导出SQL Server 2017主数据服务(MDS)模型并将其部署到另一个环境(即MDS Prod)中。

背景 (Background)

For the purposes of this demonstration, I have setup two MDS environments within a single server. As per the list of sites shown in my IIS server in Figure 1, the MDS web application simulates my development environment whilst MDSPROD is a production application.

为了演示的目的,我在单个服务器上设置了两个MDS环境。 根据图1中 IIS服务器中显示的站点列表, MDS Web应用程序模拟了我的开发环境,而MDSPROD是生产应用程序。

The MDS development application contains a single model which in turn contains a single entity called Free Products Entity. A preview of the data stored in Free Products Entity is shown in Figure 2.

MDS开发应用程序包含一个模型,该模型又包含一个称为“ 免费产品实体”的实体。 自由产品实体中存储的数据预览如图2所示。

At this point, the MDS production environment has no existing models as shown in Figure 3.

此时,MDS生产环境没有如图3所示的现有模型。

使用GUI的MDS模型部署 (MDS Model Deployment using GUI)

Migration of MDS models can be done using either a GUI-like interface or through the windows command prompt application. We start off by looking at the GUI option.

MDS模型的迁移可以使用类似于GUI的界面或通过Windows命令提示符应用程序来完成。 我们首先查看GUI选项。

Step 1: Export MDS Model into a Package file

步骤1:将MDS模型导出到包文件中

The deployment using the GUI is browser-based and relies on the MDS web application. We begin by navigating to the System Administration option as indicated in Figure 4.

使用GUI进行的部署是基于浏览器的,并且依赖于MDS Web应用程序。 首先,导航到“ 系统管理”选项, 如图4所示

Clicking on System Administration will redirect you to the Manage Models page. We next navigate and click to the Deployment sub-menu as shown in Figure 5.

单击系统管理会将您重定向到“ 管理模型”页面。 接下来,我们导航并单击Deployment子菜单, 如图5所示。

This will bring up a Model Deployment Wizard, click on the Create option as indicated in Figure 6.

这将弹出一个模型部署向导 ,单击Create选项, 如图6所示

You will next be redirected to the Create Package section wherein you will be expected to specify the MDS model you want to export – in my case, that will be ApexSQL Products.

接下来,您将被重定向到Create Package部分,在其中您将需要指定要导出的MDS模型-在我的情况下,将是ApexSQL Products

Click the Next button to export and create an MDS model package file.

单击下一步按钮以导出并创建MDS模型包文件。

Clicking the Finish button will conclude the package file creation process. All you need to do next is to click the Download button so to download and save a copy of the package file you’ve just created.

单击完成按钮将结束软件包文件的创建过程。 接下来要做的就是单击“ 下载”按钮,以便下载并保存刚创建的软件包文件的副本。

Step 2: Import MDS Package into an MDS instance

步骤2:将MDS包导入到MDS实例

Having successfully exported our MDS model into a package file, we next navigate to our MDS production web application and import the package file. We do this by firstly navigating and clicking to the System Administration option as per Figure 4.

成功将MDS模型导出到打包文件后,接下来我们导航到MDS生产Web应用程序并导入打包文件。 为此,我们首先按照图4导航并单击“ 系统管理”选项。

We then click on Deployment sub-menu as per Figure 5. This will result in the Model Deployment Wizard coming up but this time we click on Deploy as shown in Figure 8.

然后,根据图5单击Deployment子菜单。 这将导致出现Model Deployment Wizard ,但是这次我们单击Deploy如图8所示。

We are then redirected to Deploy Package window wherein we click the Browse button and specify the path to our package file.

然后,我们将重定向到“ 部署软件包”窗口,在其中单击“ 浏览”按钮并指定软件包文件的路径。

After clicking Next and Finish buttons, the Model Deployment Wizard will be closed and a subsequent page refresh of the MDS production web application should bring up the newly imported MDS model as shown in Figure 10.

单击“ 下一步”和“ 完成”按钮后,将关闭“ 模型部署向导” ,随后MDS生产Web应用程序的页面刷新将调出新导入的MDS模型, 如图10所示。

Limitation of the GUI Deployment Option

GUI部署选项的限制

Most administrators of SQL Server-based applications such as MDS prefer administration of such applications through a GUI-like interface. Whilst such a practice could be sufficient in carrying out most of the administration related tasks, the migration of an MDS model from one server to another using a GUI doesn’t migrate all required objects, lets alone data. Figure 11 gives us a production preview of the Free Products Entity which was migrated using the steps above. You will notice that unlike the development copy (shown in Figure 2), the migrated version in a production environment is missing all the data. Furthermore, the subscription views that were created in development environment are missing in the production version.

大多数基于SQL Server的应用程序(例如MDS)的管理员都喜欢通过类似于GUI的界面来管理此类应用程序。 尽管这种做法足以执行大多数与管理相关的任务,但是使用GUI将MDS模型从一台服务器迁移到另一台服务器并不能迁移所有必需的对象,更不用说数据了。 图11为我们提供了使用上述步骤迁移的免费产品实体的生产预览。 您会注意到,与开发副本(如图2所示)不同,生产环境中的迁移版本会丢失所有数据。 此外,生产版本中缺少在开发环境中创建的订阅视图。

使用Windows命令行进行MDS部署 (MDS Deployment using Windows Command Line)

We can get around the issue of missing data and subscription views prevalent in the GUI approach by turning to scripting using a windows command prompt to perform MDS Model migration. Similarly, to the GUI approach, command line approach is a two-step process that involves exporting of a given MDS model into a package file and then later importing that package file into another MDS server.

通过使用Windows命令提示符执行脚本来执行MDS模型迁移,我们可以解决GUI方法中普遍存在的数据丢失和订阅视图丢失的问题。 类似地,对于GUI方法,命令行方法是一个两步过程,涉及将给定的MDS模型导出到程序包文件中,然后将该程序包文件导入另一个MDS服务器中。

Step 1: Generate MDS Package containing Entity Data

步骤1:生成包含实体数据的MDS包

To get started, we first need to launch windows command prompt program in administrator mode. We then change the working directory to wherever the MDSModelDeploy.exe application is stored – in my case, the location is: C:\Program Files\Microsoft SQL Server\140\Master Data Services\Configuration as shown in Figure 12.

首先,我们首先需要在管理员模式下启动Windows命令提示符程序。 然后,将工作目录更改为MDSModelDeploy.exe应用程序的存储位置–在我的情况下,位置为: C:\ Program Files \ Microsoft SQL Server \ 140 \ Master Data Services \ Configuration如图12所示。

Similar to SQL Server applications such as Reporting Services and Analysis Services, several instances of MDS can be configured and run at the same time on one machine. Thus, part of migrating MDS models using windows command prompt involves identifying a list of currently configured services linked to MDS instances. Consequently, in this demonstration, we next run the listservices method to retrieve a list of existing MDS services within a given server. The results of calling the listservices method is shown in Figure 13, and as it can be seen, my demo box has two instances of MDS currently installed; MDS1 for MDS Development website as well as MDS2 for the production instance.

与诸如Reporting Services和Analysis Services之类SQL Server应用程序类似,可以配置MDS的多个实例并在一台计算机上同时运行它们。 因此,使用Windows命令提示符迁移MDS模型的一部分涉及标识链接到MDS实例的当前配置服务的列表。 因此,在此演示中,我们接下来运行listservices方法以检索给定服务器内现有MDS服务的列表。 调用listservices方法的结果如图13所示,可以看到,我的演示框中有两个当前安装的MDS实例。 用于MDS开发网站的MDS1以及用于生产实例的MDS2

The last part in this section involves the actual creation of a package file by calling the createpacakge method. As shown in Figure 14. The createpackage method has several mandatory parameters that need to be supplied and provided you have supplied correct parameter values, package creation via command prompt should be successful.

本节的最后一部分涉及通过调用createpacakge方法实际创建一个包文件。 如图14所示。 createpackage方法有几个必需参数,需要提供这些参数,并且如果您提供了正确的参数值,则通过命令提示符创建软件包的操作应该成功。

Finally, Figure 15 shows two MDS packages that were created using the GUI and command prompt program, respectively. Not surprisingly, the size of the package created using windows command prompt is larger at 16KB compared to the other package. This is because as part of creating this package we opted to include data and its related objects.

最后, 图15显示了分别使用GUI和命令提示符程序创建的两个MDS包。 毫不奇怪,与其他软件包相比,使用Windows命令提示符创建的软件包的大小更大,为16KB 。 这是因为在创建此程序包的过程中,我们选择了包含数据及其相关对象。

Step 2: Import MDS Package into an MDS instance

步骤2:将MDS包导入到MDS实例

The MDSModelDeploy utility has three main methods for deploying an MDS package file into an MDS instance. The main methods are deployclone, deployupdate, and deploynew. For the purposes of this demo, I have opted for the deploynew method which will result in a new model being created into a target server. The complete command for deploying an MDS model is shown in Script 1.

MDSModelDeploy实用程序具有三种主要方法,可用于将MDS包文件部署到MDS实例中。 主要方法是deployclonedeployupdatedeploynew 。 在此演示中,我选择了deploynew方法,这将导致在目标服务器中创建一个新模型。 脚本1中显示了用于部署MDS模型的完整命令。

MDSModelDeploy deploynew -model "ApexSQL Products" -service MDS2 -package "C:\Users\Administrator\Downloads\ApexSQLProducts.pkg"

Once we have successfully executed Script 1, the newly deployed MDS model should appear in the target server as shown in Figure 16. Notice, however, that every data entry in Free Products Entity begins with a question mark. This is used to indicate that although the MDS model was successfully deployed with data, you still need to go through the data and validate it.

成功执行脚本1之后 ,新部署的MDS模型应出现在目标服务器中, 如图16所示。 但是请注意, 免费产品实体中的每个数据条目都以问号开头。 这用于表明尽管MDS模型已成功部署了数据,但是您仍然需要遍历数据并进行验证。

摘要 (Summary)

In this article, we have gone through two main approaches for migrating an MDS model from one server to another. The GUI approach is convenient but has several limitations. On the other hand, the command line approach gives you full control and further enables you to include data as part of model deployments.

在本文中,我们经历了两种将MDS模型从一台服务器迁移到另一台服务器的主要方法。 GUI方法很方便,但是有一些限制。 另一方面,命令行方法使您可以完全控制,并进一步使您能够将数据包括在模型部署中。

参考资料 (References)

  • Master Data Services Overview (MDS) 主数据服务概述(MDS)
  • Command Prompt: What It Is and How to Use It 命令提示符:它是什么以及如何使用
  • Deploy a Model Deployment Package by Using MDSModelDeploy 使用MDSModelDeploy部署模型部署程序包

翻译自: https://www.sqlshack.com/how-to-migrate-sql-server-2017-master-data-services-models-into-another-server/

如何将SQL Server 2017主数据服务模型迁移到另一台服务器相关推荐

  1. arcgisserver修改服务器地址,ArcGIS 10.1 for Server入门(7-6)ArcGIS for Server 10.1 服务迁移与恢复--多台服务器...

    在实际的工作中,服务迁移,除了刚才的在同台服务器中迁移外,还有一种 情形,就是在多台服务器中之间迁移. 测试环境 服务器 A:ArcGIS for Server10.1+Windows Server2 ...

  2. SQL Server 2017的逐步安装

    介绍 (Introduction) The new SQL Server 2017 comes with new features in the installation. It now suppor ...

  3. RedHat宣布支持Azure、.Net Core 2.0和SQL Server 2017

    近期,Microsoft和RedHat宣布支持在Red Hat OpenShift上运行Windows容器.此次宣布所针对的主要场景,是让Linux和Windows容器工作于同一集群中.这将使具有混杂 ...

  4. SQL Server 2017 正式发布

    SQL Server 2017 跨出了重要的一步,它力求通过将 SQL Server 的强大功能引入 Linux.基于 Linux 的 Docker 容器和 Windows,使用户可以在 SQL Se ...

  5. SQL Server MDS(主数据服务)介绍

      Master Data Services(主数据服务)介绍 主数据是用来描述企业核心业务实体的数据,比如客户.合作伙伴.员工.产品.物料单.账户等:它是具有高业务价值的.可以在企业内跨越各个 ...

  6. cmd命令卸载sql server_Ubuntu下部署SQL Server 2017(安装及使用方法,卸载方法)

    SQL Server 2017 的发布是 SQL Server 历史上首次同时发布 Windows 和 Linux 版本,本文将介绍如何在 Ubuntu 下部署 SQL Server 2017,包括它 ...

  7. 关于SQL Server 2017中使用json传参时解析遇到的多层解析问题

    原文:关于SQL Server 2017中使用json传参时解析遇到的多层解析问题 开发新的系统,DB部分使用了SQL Server从2016版开始自带的Json解析方式. 用了快半年,在个人项目,以 ...

  8. SQL Server 2014 Win7 Win10 安装详解 SQL Server 2017 2019 Linux及SQL TSQL ETL实用案例

    SQL Server 2014安装图解与问题分析 简介 SQL Server2014 是Microsoft 公司推出的关系    型数据库管理系统.它用于大规模联机事务处理(OLTP).数据  仓库和 ...

  9. SQL Server 2017 2019 Linux(Centos、Unbuntu16.04、Unbuntu18.04、Unbuntu20.04)安装过程详解

    SQL Server 2017 2019 Linux安装手册 1简介 SQL Server是微软的数据库平台,而SQL Server 2017 linux是运行在linux服务器上的版本.本文的安装采 ...

最新文章

  1. 管网环的闭合差c语言编程,最大环的闭合差管网平差
  2. python查看图片的源代码_python获取图片元数据的代码
  3. LeetCode 945. 使数组唯一的最小增量(贪心)
  4. 《深度探索C++对象模型(Inside The C++ Object Model )》学习笔记
  5. Scala的设计目标——Martin Odersky访谈(二)
  6. 美化UI合约区块链学习版系统+交易大厅
  7. FLEX:target和currentTarget属性的区别
  8. linux 重新扫描pci设备,linux重新扫描pci总线
  9. access中判断回文的代码_前端也来点算法(TypeScript版) | 2 - 回文数和回文链表
  10. Microsoft.Web.RedisSessionStateProvider 运行异常问题
  11. Gamit 数据处理,相关的文件配置
  12. Docker 和 Kubernetes了解一下
  13. 工业控制系统如何实现网络安全等级保护的相关要求
  14. Word导入与发送、一键生成PPT文案
  15. 【3】Kubernetes资源管理
  16. vue3实现主题切换功能
  17. 京东 API接口:item_search - 按关键字搜索商品
  18. 平台经济反垄断,未来三年开放式金融创新机会在何处?
  19. 手机品牌中英文对照-最常用
  20. Autodesk Maya 2019 安装

热门文章

  1. Reversing.Kr replace题解
  2. 深入理解JVM之对象分配流程
  3. How to show only next line after the matched one?
  4. 浅析SQL SERVER执行计划中的各类怪相
  5. C/C++: C++可调用对象详解
  6. 20145101 《Java程序设计》第7周学习总结
  7. java语言程序设计(基础篇) 第2章 基本程序设计 课本源代码
  8. JavaScript学习(七十八)—实现对数据的浅拷贝和深拷贝
  9. .net解析传过来的xml_隧桥管廊BIM+GIS运维管理系统方案解析
  10. ipad air屏幕不能滑动,无法解锁怎么处理