1

我尝试使用以下命令行从命令提示符安装 SQL Server 2008 R2 Express

 /ACTION=Install /FEATURES=SQLEngine /INSTANCENAME=Myinstance /SQLSVCACCOUNT=NT AUTHORITY\NETWORK SERVICE /SQLSYSADMINACCOUNTS=BUILTIN\ADMINISTRATORS /IACCEPTSQLSERVERLICENSETERMS=True"

但它总是失败,我检查日志文件显示错误

 Overall summary:
  Final result: SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
 Exit code (Decimal):-2068578304
 Exit facility code:  1204
 Exit error code:    0
 Exit message: The specified credentials for the SQL Server service are not valid. To continue, provide a valid account and password for the SQL Server service.
 Start time: 2012-11-30 12:51:24
 End time:   2012-11-30 12:51:59
 Requested action:Install

Machine Properties:
 Machine name: Victor
 Machine processor count:2
 OS version:Windows 7
 OS service pack:Service Pack 1
 OS region:India
 OS language: English (United States)
 OS architecture:x64
 Process architecture: 32 Bit
 OS clustered: No

Product features discovered:
 Product              Instance             Instance ID                    Feature                                    Language             Edition              Version         Clustered 
  Sql Server 2008      SQLEXPRESS           MSSQL10.SQLEXPRESS             Database  Engine Services                 1033                 Express Edition      10.0.1600.22     No        
     Sql Server 2008      SQLEXPRESS           MSSQL10.SQLEXPRESS             SQL Server Replication                   1033                 Express Edition      10.0.1600.22    No        
  Sql Server 2008                                                          Management Tools - Basic                 1033                 Express Edition      10.0.1600.22    No        

   Package properties:
   Description:                   SQL Server Database Services 2008 R2
  ProductName:                   SQL Server 2008 R2
  Type:                          RTM
  Version:                       10
  SPLevel:                       0
  Installation location:         e:\f5b5880eab8afb8665d3b15bd6c0\x86\setup\
  Installation edition:          EXPRESS

  User Input Settings:
    ACTION:                        Install
    ADDCURRENTUSERASSQLADMIN:      True
    AGTSVCACCOUNT:                 NT AUTHORITY\NETWORK SERVICE
    AGTSVCPASSWORD:                *****
    AGTSVCSTARTUPTYPE:             Disabled
    ASBACKUPDIR:                   Backup
    ASCOLLATION:                   Latin1_General_CI_AS
    ASCONFIGDIR:                   Config
    ASDATADIR:                     Data
    ASDOMAINGROUP:                 <empty>
    ASLOGDIR:                      Log
    ASPROVIDERMSOLAP:              1
    ASSVCACCOUNT:                  <empty>
    ASSVCPASSWORD:                 *****
    ASSVCSTARTUPTYPE:              Automatic
    ASSYSADMINACCOUNTS:            <empty>
    ASTEMPDIR:                     Temp
    BROWSERSVCSTARTUPTYPE:         Automatic
    CONFIGURATIONFILE:             
    CUSOURCE:                      
    ENABLERANU:                    True
    ENU:                           True
    ERRORREPORTING:                False
    FARMACCOUNT:                   <empty>
    FARMADMINPORT:                 0
    FARMPASSWORD:                  *****
    FEATURES:                      SQLENGINE
    FILESTREAMLEVEL:               0
    FILESTREAMSHARENAME:           <empty>
    FTSVCACCOUNT:                  <empty>
    FTSVCPASSWORD:                 *****
    HELP:                          False
    IACCEPTSQLSERVERLICENSETERMS:  True
    INDICATEPROGRESS:              False
    INSTALLSHAREDDIR:              C:\Program Files (x86)\Microsoft SQL Server\
    INSTALLSHAREDWOWDIR:           C:\Program Files (x86)\Microsoft SQL Server\
    INSTALLSQLDATADIR:             <empty>
   INSTANCEDIR:                   C:\Program Files (x86)\Microsoft SQL Server\
   INSTANCEID:                    Myinstance
   INSTANCENAME:                  Myinstance
   ISSVCACCOUNT:                  
   ISSVCPASSWORD:                 *****
   ISSVCSTARTUPTYPE:              Automatic
      NPENABLED:                     0
      PASSPHRASE:                    *****
     PCUSOURCE:                     
      PID:                           *****
      QUIET:                         True
     QUIETSIMPLE:                   False
       ROLE:                          AllFeatures_WithDefaults
   RSINSTALLMODE:                 FilesOnlyMode
   RSSVCACCOUNT:                  NT AUTHORITY\NETWORK SERVICE
   RSSVCPASSWORD:                 *****
   RSSVCSTARTUPTYPE:              Automatic
   SAPWD:                         *****
   SECURITYMODE:                  <empty>
  SQLBACKUPDIR:                  <empty>
  SQLCOLLATION:                  Latin1_General_CI_AI
  SQLSVCACCOUNT:                 
  SQLSVCPASSWORD:                *****
  SQLSVCSTARTUPTYPE:             Automatic
  SQLSYSADMINACCOUNTS:           BUILTIN\ADMINISTRATORS
  SQLTEMPDBDIR:                  <empty>
 SQLTEMPDBLOGDIR:               <empty>
 SQLUSERDBDIR:                  <empty>
 SQLUSERDBLOGDIR:               <empty>
 SQMREPORTING:                  False
 TCPENABLED:                    0
 UIMODE:                        AutoAdvance
 X86:                           False

       Configuration file: C:\Program Files (x86)\Microsoft SQL Server\100\Setup Bootstrap\Log\20121130_125044\ConfigurationFile.ini

   Detailed results:
        Feature:                       Database Engine Services
       Status:                        Failed: see logs for details
       MSI status:                    Passed
      Configuration status:          Passed

       Rules with failures:

    Global rules:

       Scenario specific rules:

       Rules report file:               C:\Program Files (x86)\Microsoft SQL Server\100\Setup Bootstrap\Log\20121130_125044\SystemConfigurationCheck_Report.htm

   Exception summary:
      The following is an exception stack listing the exceptions in outermost to innermost order
    Inner exceptions are being indented

      Exception type: Microsoft.SqlServer.Chainer.Infrastructure.InputSettingValidationException
       Message: 
    The specified credentials for the SQL Server service are not valid. To continue, provide a valid account and password for the SQL Server service.
          Data: 
          SQL.Setup.FailureCategory = InputSettingValidationFailure
          DisableWatson = true
     Stack: 
           at                 Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.LogAllValidationErrorsAndThrowFirstOne(ValidationState vs)
              at Microsoft.SqlServer.Configuration.SetupExtension.ValidateFeatureSettingsAction.ExecuteAction(String actionId)
           at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
           at  
   Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter statusStream, ISequencedAction actionToRun)
    Inner exception type: Microsoft.SqlServer.Configuration.SqlEngine.ValidationException
          Message: 
               The specified credentials for the SQL Server service are not valid. To continue, provide a valid account and password for the SQL Server service.

但是当我尝试使用 c# 代码安装相同的 exe 文件时,它将成功安装

           Dim info As New System.Diagnostics.ProcessStartInfo("cmd.exe")


            info.FileName = My.Application.Info.DirectoryPath + "\SQLEXPR_x86_ENU.exe"

            info.Arguments = "/Q /ACTION=INSTALL /FEATURES=SQLEngine /INSTANCENAME=Myinstance /SQLSVCACCOUNT=" & ChrW(34) & "NT AUTHORITY\Network Service" & ChrW(34) & " /SQLSYSADMINACCOUNTS=" & ChrW(34) & "BUILTIN\ADMINISTRATORS" & ChrW(34) & " /IACCEPTSQLSERVERLICENSETERMS=" & ChrW(34) & "True" & ChrW(34)

            System.IO.File.WriteAllText("C:\\pathinsideinstaller", info.FileName)

            info.UseShellExecute = False
            info.CreateNoWindow = True
            info.WindowStyle = ProcessWindowStyle.Hidden
            Dim process As New System.Diagnostics.Process
            process.StartInfo = info
            process.Start()
            process.WaitForExit()
            process.Close()

请帮助我如何解决这个问题......

4

1 回答 1

1

由于它包含空格,因此您需要在 /SQLSVCACCOUNT 参数值周围加上双引号,如下所示:

/SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
于 2012-12-15T21:32:04.370 回答