2015-11-20 44 views
0

當我發佈包含多個文件組和文件的新數據庫時,文件組在創建數據庫時不會發布。當數據庫正在升級它的工作,這意味着我需要調用sqlpackager.exe兩次發佈數據庫。數據庫應用程序沒有在創建數據庫時部署文件組,只有升級過程

目標: 使用filegroups(共享組件)創建一個數據庫,用於分解銷售數據中的配置數據。

執行: 主數據庫項目引用一個僅包含文件組集合的公用數據庫項目。數據庫引用已正確設置。用於部署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

顯然,dacpac的已知問題。

我採用了部署db項目的方法來優先處理並創建數據庫,如果它們不存在於該數據庫的後腳本中。不是最乾淨的,但它現在會做。

相關問題