SQL SERVER – REBUILDDATABASE Error: 0x851A0012 – Missing sa Account Password. The sa Account Password is Required for SQL Authentication Mode

I was in a situation where I was helping the customer to overcome a disaster. They had a hardware failure and the master database was corrupted. The plan was to first rebuild system databases and then restore ALL databases from the backup. Today we will discuss an error about REBUILDDATABASE.

SQL SERVER - REBUILDDATABASE Error: 0x851A0012 - Missing sa Account Password. The sa Account Password is Required for SQL Authentication Mode missingaccount

REBUILDDATABASE

We used below command to rebuild system databases:

Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=MSSQLSERVER /SQLSYSADMINACCOUNTS=”domain\username”

Above command was taken from Microsoft documentation where we had some optional parameters. The setup failed with below error in the setup logs after running command related to REBUILDDATABASE.

Feature: Database Engine Services
Status: Failed: see logs for details
Reason for failure: An error occurred during the setup process of the feature.
Next Step: Use the following information to resolve the error, and then try the setup process again.
Component name: SQL Server Database Engine Services Instance Features
Component error code: 0x851A0012
Error description: Missing sa account password. The sa account password is required for SQL Authentication Mode.

WORKAROUND/SOLUTION

The documentation shows SAPWD as optional so I was missing it. It looks like if SQL was installed with MIXED mode authentication then the parameter is mandatory.

Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=APG1P /SQLSYSADMINACCOUNTS=” domain\username” /SAPWD= AVery@Strong@Password123

After running above command, the setup completed successfully. Post that we restored all the databases including master and they were back in the business.

Here are a few additional blog posts related to this blog post. Please do read them for additional information.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Error Messages, , SQL Server, SQL Server Security
Previous Post
SQL SERVER – FIX: Msg 4353 – Conflicting File Relocations Have Been Specified for File. Only a Single WITH MOVE Clause Should be Specified for Any Logical File Name
Next Post
SQL SERVER – The Future of DevOps for DBA

Related Posts

2 Comments. Leave new

  • Hi,

    Thanks for This informative blog post.

    i think this process should be enhanced by Microsoft, if “Mixed” mode is configured for SQL Logins….there are in-place security implementations required (for security compliance) against “SA” account such as resetting the account to very complex,and lengthy password in addition to disabling the account. So, what if i don’t have SA password ??!! and using another DBA account with SYSADMIN role for administration.

    I think instead of rebuilding first then restoring….you can just restore directly while enabling single user mode…is this doable ?

    Regards,
    Emad Al-Mousa

    Reply
  • Sorry, misunderstanding from my side…..the setup command when rebuilding the master database a “new” SA password will be created.

    Regards,
    Emad Al-Mousa

    Reply

Leave a Reply