当我发布包含多个文件组和文件的新数据库时,文件组不会在创建数据库时发布。当数据库正在升级时,它可以工作,这意味着我需要两次调用sqlpackager.exe来发布数据库。
目标: 使用文件组(共享组件)创建一个数据库,该数据库可以分解销售数据中的配置数据。
实现: 主数据库项目引用一个公共数据库项目,该项目仅包含一组文件组。数据库引用已正确设置。与dacpac部署一起使用的发布文件正确设置属性:IgnoreFileGroupPlacement(FALSE) 主数据库项目具有要添加到文件组的文件列表。 我正在创建一个名为“defaultworkingspace”的文件组,将除了系统对象之外的所有内容都移除,我将此文件组标记为默认值。 当我第一次部署时,我得到以下错误:
Initializing deployment (Start)
*** A project which specifies SQL Server 2008 as the target platform may experience compatibility issues with SQL Server 2005.
*** The following SqlCmd variables are not defined in the target scripts: SourceCode SourceId.
Initializing deployment (Complete)
Analyzing deployment plan (Start)
Analyzing deployment plan (Complete)
Updating database (Start)
Creating Register_DB...
An error occurred while the batch was being executed.
Updating database (Failed)
*** Could not deploy package.
Warning SQL0: A project which specifies SQL Server 2008 as the target platform may experience compatibility issues with SQL Server 2005.
Warning SQL72013: The following SqlCmd variables are not defined in the target scripts: SourceCode SourceId.
Error SQL72014: .Net SqlClient Data Provider: Msg 5014, Level 16, State 2, Line 1 The filegroup 'DefaultWorkingSpace' does not exist in database 'Register_DB'.
Error SQL72045: Script execution error. The executed script:
ALTER DATABASE [$(DatabaseName)]
MODIFY FILEGROUP [DefaultWorkingSpace] DEFAULT;
默认设置是作为部署后脚本的一部分进行的,因此它应该与所有后部署脚本一起运行。当我再次部署它时,现在作为已创建数据库的升级
Initializing deployment (Start)
*** A project which specifies SQL Server 2008 as the target platform may experience compatibility issues with SQL Server 2005.
*** The following SqlCmd variables are not defined in the target scripts: SourceCode SourceId.
*** The source's object [Register_DB] is different than the target's version of the object but the target object will not be updated.
*** The object [Register_DB] already exists in database with a different definition and will not be altered.
Initializing deployment (Complete)
Analyzing deployment plan (Start)
Analyzing deployment plan (Complete)
Updating database (Start)
Creating [Configuration]...
Creating [DefaultWorkingSpace]...
Creating [Giftcards]...
Creating [Logging]...
Creating [MasterData]...
Creating [Mobile]...
Creating [Sales]...
Creating [Config]...
Creating [Working]...
Creating [Giftcards]...
Creating [Logging]...
Creating [Master]...
Creating [Sales]...
升级过程支持文件组似乎很奇怪,但数据库的初始创建却没有......有没有人遇到过这个问题?
答案 0 :(得分:0)
dacpac的已知问题显然。
我采用了部署db项目的方法来预先掌握并创建db,如果它们不存在于该db的后脚本中。不是最干净的,但它现在就做了。