2013-02-18 62 views
5

我想在使用WiX 3.6的安裝過程中創建數據庫。我遵循了很多教程,但我認爲我做錯了一些事情。'錯誤-2147467259:無法在WiX中創建SQL數據庫'

<?xml version="1.0" encoding="UTF-8"?> 
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
    xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" 
    xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension"> 

    <Product Id="{A704CA9E-2833-4276-A8A8-148F1047332F}" Name="DbInstallerTest" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="2de42bd8-acc2-48bf-b3c6-09745d3a2ea4"> 
     <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

     <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
     <MediaTemplate /> 

     <Feature Id="ProductFeature" Title="DbInstallerTest" Level="1"> 
      <ComponentGroupRef Id="ProductComponents" /> 
     </Feature> 
    </Product> 

    <Fragment> 
     <Directory Id="TARGETDIR" Name="SourceDir"> 
      <Directory Id="ProgramFilesFolder"> 
       <Directory Id="INSTALLFOLDER" Name="DbInstallerTest" /> 
      </Directory> 
     </Directory> 
    </Fragment> 

    <Fragment> 
     <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 

      <Component Id="CMPDbInsatller" 
         Guid="{1749E57D-9CE4-42F8-924C-2A2E368B51E4}"> 
       <CreateFolder Directory="INSTALLFOLDER"/> 
       <util:User Id="SqlUser" 
          Name="sa" 
          Password="[email protected]"/> 
      </Component> 
      <Component Id="cmp2" 
         Guid="{C3596364-61A0-4628-9153-1BA11DB4B778}"> 
       <CreateFolder Directory="INSTALLFOLDER"/> 
       <sql:SqlDatabase Id="Id_db" 
           Database="TestDatabase1" 
           Server="(local)\SQLExpress" 
           CreateOnInstall="yes" 
           User="SqlUser" 
           DropOnUninstall="yes"> 
       </sql:SqlDatabase> 
      </Component> 
     </ComponentGroup> 
    </Fragment> 
</Wix> 

上面的代碼給出了以下錯誤。

Error -2147467259: failed to create SQL database: TestDatabase1. error detail: Unknown error.

這裏是日誌的內容,

=== Logging started: 2/18/2013 11:00:59 === 
Action 11:00:59: INSTALL. 
Action start 11:00:59: INSTALL. 
Action 11:00:59: FindRelatedProducts. Searching for related applications 
Action start 11:00:59: FindRelatedProducts. 
Action ended 11:00:59: FindRelatedProducts. Return value 1. 
Action 11:00:59: LaunchConditions. Evaluating launch conditions 
Action start 11:00:59: LaunchConditions. 
Action ended 11:00:59: LaunchConditions. Return value 1. 
Action 11:00:59: ValidateProductID. 
Action start 11:00:59: ValidateProductID. 
Action ended 11:00:59: ValidateProductID. Return value 1. 
Action 11:00:59: CostInitialize. Computing space requirements 
Action start 11:00:59: CostInitialize. 
Action ended 11:00:59: CostInitialize. Return value 1. 
Action 11:00:59: FileCost. Computing space requirements 
Action start 11:00:59: FileCost. 
Action ended 11:00:59: FileCost. Return value 1. 
Action 11:00:59: CostFinalize. Computing space requirements 
Action start 11:00:59: CostFinalize. 
Action ended 11:00:59: CostFinalize. Return value 1. 
Action 11:00:59: MigrateFeatureStates. Migrating feature states from related applications 
Action start 11:00:59: MigrateFeatureStates. 
Action ended 11:00:59: MigrateFeatureStates. Return value 0. 
Action 11:00:59: ExecuteAction. 
Action start 11:00:59: ExecuteAction. 
Action start 11:01:01: INSTALL. 
Action start 11:01:01: FindRelatedProducts. 
Action ended 11:01:01: FindRelatedProducts. Return value 0. 
Action start 11:01:01: LaunchConditions. 
Action ended 11:01:01: LaunchConditions. Return value 1. 
Action start 11:01:01: ValidateProductID. 
Action ended 11:01:01: ValidateProductID. Return value 1. 
Action start 11:01:01: CostInitialize. 
Action ended 11:01:01: CostInitialize. Return value 1. 
Action start 11:01:01: FileCost. 
Action ended 11:01:01: FileCost. Return value 1. 
Action start 11:01:01: CostFinalize. 
Action ended 11:01:01: CostFinalize. Return value 1. 
Action start 11:01:01: MigrateFeatureStates. 
Action ended 11:01:01: MigrateFeatureStates. Return value 0. 
Action start 11:01:01: InstallValidate. 
Action ended 11:01:01: InstallValidate. Return value 1. 
Action start 11:01:01: RemoveExistingProducts. 
Action ended 11:01:01: RemoveExistingProducts. Return value 1. 
Action start 11:01:01: InstallInitialize. 
Action ended 11:01:01: InstallInitialize. Return value 1. 
Action start 11:01:01: ProcessComponents. 
Action ended 11:01:01: ProcessComponents. Return value 1. 
Action start 11:01:01: UnpublishFeatures. 
Action ended 11:01:01: UnpublishFeatures. Return value 1. 
Action start 11:01:01: UninstallSqlData. 
Action ended 11:01:02: UninstallSqlData. Return value 1. 
Action start 11:01:02: RemoveFiles. 
Action ended 11:01:02: RemoveFiles. Return value 0. 
Action start 11:01:02: RemoveFolders. 
Action ended 11:01:02: RemoveFolders. Return value 1. 
Action start 11:01:02: CreateFolders. 
Action ended 11:01:02: CreateFolders. Return value 1. 
Action start 11:01:02: ConfigureUsers. 
Action start 11:01:02: CreateUserRollback. 
Action ended 11:01:02: CreateUserRollback. Return value 1. 
Action start 11:01:02: CreateUser. 
Action ended 11:01:02: CreateUser. Return value 1. 
Action ended 11:01:02: ConfigureUsers. Return value 1. 
Action start 11:01:02: InstallFiles. 
Action ended 11:01:02: InstallFiles. Return value 1. 
Action start 11:01:02: InstallSqlData. 
Action start 11:01:19: CreateDatabase. 
Action ended 11:01:19: CreateDatabase. Return value 1. 
Action ended 11:01:19: InstallSqlData. Return value 1. 
Action start 11:01:19: RegisterUser. 
Action ended 11:01:19: RegisterUser. Return value 1. 
Action start 11:01:19: RegisterProduct. 
Action ended 11:01:19: RegisterProduct. Return value 1. 
Action start 11:01:19: PublishFeatures. 
Action ended 11:01:19: PublishFeatures. Return value 1. 
Action start 11:01:19: PublishProduct. 
Action ended 11:01:19: PublishProduct. Return value 1. 
Action start 11:01:19: InstallFinalize. 
CreateDatabase: Error 0x80004005: failed to create to database: 'TestDatabase1', error: 

unknown error 
Error 26201. Error -2147467259: failed to create SQL database: TestDatabase1, error detail: 

unknown error. 
MSI (s) (94!44) [11:01:47:973]: Product: DbInstallerTest -- Error 26201. Error -2147467259: 

failed to create SQL database: TestDatabase1, error detail: unknown error. 

CustomAction CreateDatabase returned actual error code 1603 (note this may not be 100% 

accurate if translation happened inside sandbox) 
Action ended 11:01:47: InstallFinalize. Return value 3. 
Action ended 11:01:48: INSTALL. Return value 3. 
Action ended 11:01:48: ExecuteAction. Return value 3. 
Action ended 11:01:48: INSTALL. Return value 3. 
=== Logging stopped: 2/18/2013 11:01:48 === 
MSI (c) (C0:94) [11:01:48:208]: Product: DbInstallerTest -- Installation failed. 

MSI (c) (C0:94) [11:01:48:209]: Windows Installer installed the product. Product Name: 

DbInstallerTest. Product Version: 1.0.0.0. Product Language: 1033. Manufacturer: Microsoft. 

Installation success or error status: 1603. 

我在做什麼錯在這裏?

回答

2

Err 26201更有用。您還應該在事件日誌中看到更多信息。

您的代碼表明您正在SQL實例上使用混合模式並將身份驗證用作SQL登錄名。這表明問題很可能是您的SQL服務帳戶沒有權限在默認位置創建MDF和LDF文件。

更多信息請參見本主題:

Error 26201. Error -2147467259: failed to create SQL database

6

我們周圍追逐這個錯誤了一個星期前最後通過進入SQL   Server配置管理器→SQL Server網絡配置→協議解決它對於MSSQLSERVER(對於我們來說,默認實例)→啓用命名管道和TCP/IP協議。

1

因此,我的WiX安裝程序日誌中也出現錯誤,但稍有不同。

環境:

  • 的WebServer =的Windows 2008 R2
  • SQLServer的= Windows 2008的32位的SQL Server 2008 R2標準
  • 混合模式身份驗證
  • 默認SQL實例

錯誤:

ExecuteSqlStrings: Entering ExecuteSqlStrings in C:\Windows\Installer\MSI1EC7.tmp, version 3.6.3303.0

ExecuteSqlStrings: Error 0x80004005: failed to connect to database: 'DatabaseNameBla'

Error 26203. Failed to connect to SQL database. (-2147467259 DatabaseNameBla ) MSI (s) (20!30) [10:16:32:225]: Product: Bla Services -- Error 26203. Failed to connect to SQL database. (-2147467259 DatabaseNameBla )

研究:

  • 實例DB似乎只有1.6 GB留在硬盤上。 < <這可能是不好的...
  • 我的用戶是sysadmin
  • 通過SQL管理工具訪問對同一個用戶沒有問題。
  • SLQ日誌沒有任何內容來幫助解決錯誤。只是噪音。

我的解決方案:

  • VM擁有50 GB的免費
  • 新的數據庫實例的d驅動
  • 新實例設置一個d驅動混合模式
  • 重新安裝。成功!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

摘要:

所以試圖找出這筆交易小時後。在此錯誤的情況下,它與硬盤驅動器的可用空間大小有關。由於SQL Server在生產中,我們無法擴展C驅動器以查看是否修復了默認實例。

2

我也遇到了這個問題,我瀏覽了很多論壇來解決這個問題。這是唯一對我有用的東西。在我的電腦時,SQL Server Express版本數據庫的創建與 -2147467259失敗:無法創建SQL數據庫:

After days of hacking I finally found the solution! All you need to do is use .\sqlexpress instead of localhost\sqlexpress or 127.0.0.1\sqlexpress in your connection string. I think (and I might be terribly wrong here) when you use .\sqlexpress in connection string installer uses Shared Memory instead of Named Pipes or TCP/IP.

來源:Solution to -2147467259: failed to create SQL database

相關問題