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.
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.
- SQL SERVER – Difference Between SQL Login and SQL User – SQL in Sixty Seconds #070
- SQL SERVER – Errorlog The Server was Unable to Initialize Encryption Because of a Problem with a Security Library
- SQL SERVER – Beginning of SQL Server SecuritySecurity means that only relevant data should be available to authenticated persons. It additionally includes appropriate restrictions on the use of data, as well as controls to prohibit data theft. In case data is stolen by unauthorized users, security systems do not allow them to make use of it.
Reference: Pinal Dave (https://blog.sqlauthority.com)
First appeared on SQL SERVER – REBUILDDATABASE Error: 0x851A0012 – Missing sa Account Password. The sa Account Password is Required for SQL Authentication Mode