今天遇到一个案例,在使用命令修改一个测试服务器(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 Specifies that SQL Server Setup should not manage
the SQL Server services. This option should be
used only in a non-Microsoft cluster environment.
COMMFABRICENCRYPTION MATRIXCOMMMESSAGEPROTECTION {0,1}
COMMFABRICNETWORKLEVEL MATRIXCOMMNETWORKISOLATION {0,1}
COMMFABRICPORT MATRIXCOMMPORT
CONFIGURATIONFILE Specifies the configuration file to be used for
Setup.
CONFIRMIPDEPENDENCYCHANGE Indicates that the change in IP address resource
dependency type for the SQL Server multi-subnet
failover cluster is accepted.
CTLRSTARTUPTYPE The startup type for the Distributed Replay
Controller service.
CTLRSVCACCOUNT The account used by the Distributed Replay
Controller service.
CTLRSVCPASSWORD The password for the Distributed Replay
Controller service account.
CTLRUSERS The Windows account(s) used to grant permission
to the Distributed Replay Controller service.
ENABLERANU Set to "1" to enable RANU for SQL Server Express.
ENU Use the /ENU parameter to install the English
version of SQL Server on your localized Windows
operating system.
ERRORREPORTING Specify if errors can be reported to Microsoft to
improve future SQL Server releases. Specify 1 or
True to enable and 0 or False to disable this
feature.
FAILOVERCLUSTERDISKS Specifies a cluster shared disk to associate with
the SQL Server failover cluster instance.
FAILOVERCLUSTERGROUP Specifies the name of the cluster group for the
SQL Server failover cluster instance.
FAILOVERCLUSTERIPADDRESSES Specifies an encoded IP address. The encodings
are semicolon-delimited (;), and follow the
format;; ; mask>. Supported IP types include DHCP, IPV4, andIPV6.FAILOVERCLUSTERNETWORKNAME Specifies the name of the SQ LServer failovercluster instance. This name is the network namethat is used to connect to SQL Server services.FAILOVERCLUSTERROLLOWNERSHIP Specifies whether the upgraded nodes should takeownership of the failover instance group or not.Use 0 to retain ownership in the legacy nodes, 1
to make the upgraded nodes take ownership, or 2to let SQL Server Setup decide when to moveownership.FEATURES Specifies features to install, uninstall, orupgrade. The list of top-level features includeSQL, AS, RS, IS, MDS, and Tools. The SQL featurewill install the Database Engine, Replication,Full-Text, and Data Quality Services (DQS)server. The Tools feature will install ManagementTools, Books online components, SQL Server DataTools, and other shared components.FILESTREAMLEVEL Level to enable FILESTREAM feature at (0, 1, 2 or3).FILESTREAMSHARENAME Name of Windows share to be created for
FILESTREAM File I/O.FTSVCACCOUNT User account for Full-text Filter Daemon Host.
FTSVCPASSWORD User password for Full-text Filter Daemon Host
account.FTUPGRADEOPTION Full-text catalog upgrade option.HELP Displays the command line parameters usageIACCEPTSQLSERVERLICENSETERMS By specifying this parameter and accepting theSQL Server license terms, you acknowledge thatyou have read and understood the terms of use.INDICATEPROGRESS Specifies that the detailed Setup log should bepiped to the console.INSTALLSHAREDDIR Specify the root installation directory for
shared components. This directory remainsunchanged after shared components are alreadyinstalled.INSTALLSHAREDWOWDIR Specify the root installation directory for the
WOW64 shared components. This directory remainsunchanged after WOW64 shared components arealready installed.INSTALLSQLDATADIR The Database Engine root data directory.INSTANCEDIR Specify the instance root directory.INSTANCEID Specify the Instance ID for the SQL Server
features you have specified. SQL Server directorystructure, registry structure, and service nameswill incorporate the instance ID of the SQLServer instance.INSTANCENAME Specify a default or named instance. MSSQLSERVER
is the default instance for non-Express editionsand SQLExpress for Express editions. This
parameter is required when installing the SQLServer Database Engine (SQL), Analysis Services(AS), or Reporting Services (RS).ISSVCACCOUNT Either domain user name or system account.ISSVCPASSWORD Password for domain user.
ISSVCSTARTUPTYPE Automatic, Manual or Disabled.MATRIXCMBRICKCOMMPORT MATRIXCMBRICKCOMMPORT portNumberMATRIXCMSERVERNAME MATRIXCMSERVERNAME hostName\instanceNameMATRIXNAME MATRIXNAME=NPENABLED Specify 0 to disable or 1 to enable the NamedPipes protocol.PID Specify the SQL Server product key to configurewhich edition you would like to use.QUIET Setup will not display any user interface.QUIETSIMPLE Setup will display progress only, without anyuser interaction.ROLE Detailed help for command line argument ROLE has
not been defined yet.RSCATALOGSERVERINSTANCENAME The SQL Server server for the report server
catalog database.RSINSTALLMODE RSInputSettings_RSInstallMode_DescriptionRSSHPINSTALLMODE RSInputSettings_RSInstallMode_DescriptionRSSVCACCOUNT Specify the service account of the report server.This value is required. If you omit this value,Setup will use the default built-in account forthe current operating system (eitherNetworkService or LocalSystem). If you specify adomain user account, the domain must be under 254characters and the user name must be under 20characters. The account name cannot contain thefollowing characters:" / \ [ ] : ; | = , + * ? < >
RSSVCPASSWORD Specify a strong password for the account. Astrong password is at least 8 characters andincludes a combination of upper and lower casealphanumeric characters and at least one symbolcharacter. Avoid spelling an actual word or namethat might be listed in a dictionary.RSSVCSTARTUPTYPE Specifies the startup mode for the Report Serverservice. Valid values include Manual, Automatic,and Disabled. The default value for StartupTypeis Manual, where the server is started when arequest is received.RSUPGRADEDATABASEACCOUNT RSInputSettings_RSInstallMode_DescriptionRSUPGRADEPASSWORD RSInputSettings_RSInstallMode_DescriptionRULES Specifies the list of rule IDs or rule group IDsto run.SAPWD Password for SQL Server sa account.SECURITYMODE The default is Windows Authentication. Use "SQL"
for Mixed Mode Authentication.SQLBACKUPDIR Default directory for the Database Engine backupfiles.SQLCOLLATION Specifies a Windows collation or an SQL collationto use for the Database Engine.SQLSVCACCOUNT Account for SQL Server service: Domain\User orsystem account.SQLSVCPASSWORD A SQL Server service password is required onlyfor a domain account.SQLSVCSTARTUPTYPE Startup type for the SQL Server service.SQLSYSADMINACCOUNTS Windows account(s) to provision as SQL Serversystem administrators.SQLTEMPDBDIR Directory for Database Engine TempDB files.SQLTEMPDBLOGDIR Directory for the Database Engine TempDB logfiles.SQLUSERDBDIR Default directory for the Database Engine userdatabases.SQLUSERDBLOGDIR Default directory for the Database Engine userdatabase logs.SQMREPORTING Specify that SQL Server feature usage data can becollected and sent to Microsoft. Specify 1 orTrue to enable and 0 or False to disable thisfeature.TCPENABLED Specify 0 to disable or 1 to enable the TCP/IPprotocol.UIMODE Parameter that controls the user interfacebehavior. Valid values are Normal for the fullUI,AutoAdvance for a simplied UI, andEnableUIOnServerCore for bypassing Server Coresetup GUI block.UpdateEnabled Specify whether SQL Server Setup should discoverand include product updates. The valid values areTrue and False or 1 and 0. By default SQL ServerSetup will include updates that are found.UpdateSource Specify the location where SQL Server Setup willobtain product updates. The valid values are "MU"
to search Microsoft Update, a valid folder path,a relative path such as .\MyUpdates or a UNCshare. By default SQL Server Setup will searchMicrosoft Update or a Windows Update servicethrough the Window Server Update Services.USEMICROSOFTUPDATE If this parameter is provided, then this computerwill use Microsoft Update to check for updates.X86 Specifies that Setup should install into WOW64.This command line argument is not supported on anIA64 or a 32-bit system.Full unattended installation example, showing all required parameters:setup.exe /Q /IACCEPTSQLSERVERLICENSETERMS /ACTION=install /PID=/FEAT URES=SQL,AS,RS,IS,Tools/INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="MyDomain\MyAccount"
/SQLSVCPASSWORD="************" /SQLSYSADMINACCOUNTS="MyDomain\MyAccount "/AGTSVCACCOUNT="MyDomain\MyAccount" /AGTSVCPASSWORD="************"/ASSVCACCOUNT="MyDomain\MyAccount" /ASSVCPASSWORD="************"/RSSVCACCOUNT="MyDomain\MyAccount" /RSSVCPASSWORD="************"/ISSVCAccount="MyDomain\MyAccount" /ISSVCPASSWORD="************"/ASSYSADMINACCOUNTS="MyDomain\MyAccount"Press any key to exit...