我有一个数据库的 "ideal" 版本的 DACPAC,还有一些可能不同的生产数据库。我怎样才能得到一份比较它们的报告?
I have a DACPAC of the "ideal" version of a database, and also some production databases which may differ. How can I get a report comparing them?
此 DACPAC 用于测试部署;但是我们无法将它用于生产部署,因为所有生产数据库都以某种方式不同步。我打算 运行 Schema Compare in Visual Studio 依次将每个数据库与 DACPAC 进行比较并记下所有差异,但差异比我预期的要多得多,而且要花很长时间才能写出来他们都下来了。有没有什么方法可以为每个数据库生成一份报告,详细说明该数据库中所有数据库对象与 DACPAC 相比的差异?
SqlPackage.exe 是 Visual Studio Schema Compare 使用的部署引擎,它还有额外的选项:
SqlPackage.exe is a command-line utility that automates the following
database development tasks:
Version: Returns the build number of the SqlPackage application. Added
in version 18.6.
Extract: Creates a data-tier application (.dacpac) file containing the
schema or schema and user data from a connected SQL database.
Publish: Incrementally updates a database schema to match the schema
of a source .dacpac file. If the database does not exist on the
server, the publish operation creates it. Otherwise, an existing
database is updated.
Export: Exports a connected SQL database - including database schema
and user data - to a BACPAC file (.bacpac).
Import: Imports the schema and table data from a BACPAC file into a
new user database.
DeployReport: Creates an XML report of the changes that would be made
by a publish action.
DriftReport: Creates an XML report of the changes that have been made
to a registered database since it was last registered.
Script: Creates a Transact-SQL incremental update script that updates
the schema of a target to match the schema of a source.
The SqlPackage.exe command line allows you to specify these actions
along with action-specific parameters an
有一个新的 Powershell 模块:DACPACComparator
https://www.powershellgallery.com/packages/DacpacComparator/2.0
比较 2 DACPAC 并为您提供差异。
你可以利用它。
此 DACPAC 用于测试部署;但是我们无法将它用于生产部署,因为所有生产数据库都以某种方式不同步。我打算 运行 Schema Compare in Visual Studio 依次将每个数据库与 DACPAC 进行比较并记下所有差异,但差异比我预期的要多得多,而且要花很长时间才能写出来他们都下来了。有没有什么方法可以为每个数据库生成一份报告,详细说明该数据库中所有数据库对象与 DACPAC 相比的差异?
SqlPackage.exe 是 Visual Studio Schema Compare 使用的部署引擎,它还有额外的选项:
SqlPackage.exe is a command-line utility that automates the following database development tasks:
Version: Returns the build number of the SqlPackage application. Added in version 18.6.
Extract: Creates a data-tier application (.dacpac) file containing the schema or schema and user data from a connected SQL database.
Publish: Incrementally updates a database schema to match the schema of a source .dacpac file. If the database does not exist on the server, the publish operation creates it. Otherwise, an existing database is updated.
Export: Exports a connected SQL database - including database schema and user data - to a BACPAC file (.bacpac).
Import: Imports the schema and table data from a BACPAC file into a new user database.
DeployReport: Creates an XML report of the changes that would be made by a publish action.
DriftReport: Creates an XML report of the changes that have been made to a registered database since it was last registered.
Script: Creates a Transact-SQL incremental update script that updates the schema of a target to match the schema of a source.
The SqlPackage.exe command line allows you to specify these actions along with action-specific parameters an
有一个新的 Powershell 模块:DACPACComparator https://www.powershellgallery.com/packages/DacpacComparator/2.0 比较 2 DACPAC 并为您提供差异。 你可以利用它。