今天遇到一個案例,在使用命令修改一個測試伺服器(SQL Server 2014標準版)的伺服器排序規則時,遇到了下麵錯誤信息 (具體賬號信息脫敏處理,隨機生成一個賬號密碼) The Windows account sa does not exist and cannot be provisioned... ...
今天遇到一個案例,在使用命令修改一個測試伺服器(SQL Server 2014標準版)的伺服器排序規則時,遇到了下麵錯誤信息
(具體賬號信息脫敏處理,隨機生成一個賬號密碼)
The Windows account sa does not exist and cannot be provisioned as a SQL Server system administrator
c:\SQLServer_12.0_Full>Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQL
SERVER /SQLSYSADMINACCOUNTS=sa /SAPWD=Sa!y#456 /SQLCOLLATION=Chinese_PRC_CI_AS
Microsoft (R) SQL Server 2014 12.00.5000.00
Copyright (c) Microsoft Corporation. All rights reserved.
The following error occurred:
The Windows account sa does not exist and cannot be provisioned as a SQL Server
system administrator.
Error result: -2061893626
Result facility code: 1306
Result error code: 6
Please review the summary.txt log for further details
後面折騰了很久後,發現這種寫法居然是錯誤的,由於自己在動手之前參考了自己以前寫的MS SQL 排序規則總結這篇博文,結果發現自己一些不嚴謹/錯誤的地方把自己也給坑了。希望不要把別人也坑了!!!時間太久遠了,怎麼也想不起當初怎麼造就了這樣一個錯誤, 總之,那篇博文裡面確實有一個錯誤的地方。希望以後要引以為戒!
正確的寫法為/SQLSYSADMINACCOUNTS參數後指定域賬號或本機NT賬號,這個可以通過查看幫助信息
c:\SQLServer_12.0_Full>Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER
/SQLSYSADMINACCOUNTS=azrnt18\azrnt18 /SAPWD="Sa!y#456" /SQLCOLLATION=Chinese_PRC_CI_AS
Microsoft (R) SQL Server 2014 12.00.5000.00
Copyright (c) Microsoft Corporation. All rights reserved.
setup /? 或setup /help查看參數信息,SQLSYSADMINACCOUNTS的介紹、解釋如下所示:
SQLSYSADMINACCOUNTS Windows account(s) to provision as SQL Server system administrators.
也就是說SQLSYSADMINACCOUNTS參數後指定的是有SQL Server管理員許可權的Windows賬號,由於最上面最上面指定參數的值為sa,所以才會一直報這個錯誤。
c:\SQLServer_12.0_Full>setup /help
Microsoft (R) SQL Server 2014 12.00.5000.00
Copyright (c) Microsoft Corporation. All rights reserved.
Usage:
setup.exe /[option]={value} /[option]={value} ...
Options:
ACTION Specifies a Setup work flow, like INSTALL,
UNINSTALL, or UPGRADE. This is a required
parameter.
ADDCURRENTUSERASSQLADMIN Provision current user as a Database Engine
system administrator for %SQL_PRODUCT_SHORT_NAME%
Express.
AGTDOMAINGROUP Either domain user name or system account
AGTSVCACCOUNT Either domain user name or system account
AGTSVCPASSWORD Password for domain user name. Not required for
system account
AGTSVCSTARTUPTYPE Startup type for the SQL Server Agent service.
Supported values are Manual, Automatic or
Disabled.
ALLINSTANCES Specifies that all instances are to be included
in the Setup operation. This parameter is
supported only when applying a patch.
ALLOWUPGRADEFORSSRSSHAREPOIN
RSInputSettings_AllowUpgradeForSSRSSharePointMode_
Description
ASBACKUPDIR The location for the Analysis Services backup
files.
ASCOLLATION The collation used by Analysis Services.
ASCONFIGDIR The location for the Analysis Services
configuration files.
ASDATADIR The location for the Analysis Services data
files.
ASLOGDIR The location for the Analysis Services log files.
ASPROVIDERMSOLAP Specifies if the MSOLAP provider can run in
process.
ASSERVERMODE Specifies the server mode of the Analysis
Services instance. Valid values are
MULTIDIMENSIONAL and TABULAR. The default value
is MULTIDIMENSIONAL.
ASSVCACCOUNT The account used by the Analysis Services
service.
ASSVCPASSWORD The password for the Analysis Services service
account.
ASSVCSTARTUPTYPE Controls the service startup type setting for the
service.
ASSYSADMINACCOUNTS Specifies the list of administrator accounts to
provision.
ASTEMPDIR The location for the Analysis Services temporary
files.
BROWSERSVCSTARTUPTYPE Startup type for Browser Service.
CLTCTLRNAME The computer name that the client communicates
with for the Distributed Replay Controller
service.
CLTRESULTDIR The result directory for the Distributed Replay
Client service.
CLTSTARTUPTYPE The startup type for the Distributed Replay
Client service.
CLTSVCACCOUNT The account used by the Distributed Replay Client
service.
CLTSVCPASSWORD The password for the Distributed Replay Client
service account.
CLTWORKINGDIR The working directory for the Distributed Replay
Client service.
CLUSTERPASSIVE