简体   繁体   English

SQL Server 具有相同架构的多个数据库

[英]SQL server multiple databases with same schema

I have a solution that is sharded across multiple SQL Azure databases.我有一个跨多个 SQL Azure 数据库分片的解决方案。 These databases all have the exact same data schema and I generate an edmx from one of them.这些数据库都具有完全相同的数据模式,我从其中一个生成了一个 edmx。

How can I maintain the schemas of multiple databases with respect to change management?如何在变更管理方面维护多个数据库的模式? Any change in one schema has to be automatically applied on all the other databases.一个模式中的任何更改都必须自动应用于所有其他数据库。 Is there something I am missing?有什么我想念的吗? I looked at data sync but it seems to be solving another problem.我查看了数据同步,但它似乎正在解决另一个问题。 In my case the schema is exactly the same and the data stored is different.在我的情况下,模式完全相同,存储的数据不同。

This can be achieved using SSDT (Addin for VS) and Automated deployment tools (I use Final Builder).这可以使用 SSDT(VS 插件)和自动化部署工具(我使用 Final Builder)来实现。

I currently use SSDT tools where I created a database project of the original schema.我目前使用 SSDT 工具,在其中创建了原始模式的数据库项目。 If there is any changes to one of the databases, i use schema compare in SSDT and update the database project.如果其中一个数据库有任何更改,我会在 SSDT 中使用模式比较并更新数据库项目。 Then I follow the below steps to rollout the changes to other databases.然后我按照以下步骤将更改部署到其他数据库。

Step 1: Update the schema changes to database Project.步骤 1:将架构更改更新到数据库 Project。

Step 2: Use MSBuild and Generate a deployment script by setting one of the databases as Target.步骤 2:使用 MSBuild 并通过将数据库之一设置为目标来生成部署脚本。

Step 3: Run the generated script across all the databases using any auto deployment tools.步骤 3:使用任何自动部署工具在所有数据库中运行生成的脚本。

If you're always using Entity Framework migrations to make changes to the database structure, then you might be able to use the approach on the below.如果您总是使用实体框架迁移来更改数据库结构,那么您可能可以使用下面的方法。 It depends a little on how your multiple databases are used in relation to the EF application.这在一定程度上取决于与 EF 应用程序相关的多个数据库的使用方式。

Or you can use the EF migrations to generate a script that you can run on each server manually.或者,您可以使用 EF 迁移来生成可以在每个服务器上手动运行的脚本

If you're interested in an automated process it might be worth taking a look at Deployment Manager from Red Gate (full disclose I work for Red Gate).如果您对自动化流程感兴趣,可能值得一看 Red Gate 的部署管理器(完全公开我为 Red Gate 工作)。

This lets you take a database and from Visual Studio or SSMS turn it into a package that you can deploy to multiple servers and environments.这使您可以获取数据库并从 Visual Studio 或 SSMS 将其转换为可以部署到多个服务器和环境的包。 The starter edition for up to 5 projects and 5 servers is free to use, and it deploys to Azure.最多 5 个项目和 5 个服务器的入门版可以免费使用,并且部署到 Azure。 It can deploy .NET web applications too, but you can just use it for the DB.它也可以部署 .NET Web 应用程序,但您只能将它用于数据库。

It's very good for ensuring that the same database schema is on all servers within an environment, and for propagating database changes through test/staging/prod in line with any application changes.这对于确保在一个环境中的所有服务器上使用相同的数据库模式,以及通过测试/暂存/生产传播数据库更改以与任何应用程序更改保持一致非常有用。 You can also integrate it with source control and CI systems to automate database changes from Dev to Production您还可以将其与源代码控制和 CI 系统集成,以自动化从开发到生产的数据库更改

有一个名为 Airbyte 的工具,它用于在各种数据库服务器之间同步(计划/自动化)和复制一个数据库实例(完整数据库或仅选择)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用相同的架构访问多个SQL数据库 - Accessing multiple SQL databases with the same schema 同一SQL Server上的多个数据库(MS SQL) - Multiple Databases on the same SQL Server (MS SQL) 如何在 SQL Server 中同时更新多个数据库? - How can i update multiple databases at the same time in SQL Server? 为Sql Server中的所有数据库创建架构 - Creating schema for all databases in Sql Server SQL - 服务器上所有数据库的 INFORMATION_SCHEMA - SQL - INFORMATION_SCHEMA for All Databases On Server 在同一实例中使用相同名称(每个数据库用于不同的国家)处理多个SQL Server数据库的正确策略是什么? - What is the correct strategy for handling multiple SQL Server databases in the same instance with the same name (each one for a different country)? 一次更新多个 SQL 数据库中的 SQL 模式 - Updating SQL Schema in Multiple SQL Databases at One Time 如何在 sql 服务器中配置多个目录/数据库,这些目录/数据库位于 spring 启动 java 8 应用程序中的同一数据库服务器上? - How to configure multiple catalogs/databases in sql server which are on same database server in spring boot java 8 app? 何时在同一服务器上使用单独的SQL数据库? - When to use separate SQL databases on the same server? 对多个数据库执行相同的 SQL 查询 - Perform same SQL query on multiple databases
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM