One Way without Restart Service
I’ve come across a great way of resetting a SQL server “sa” password if you don’t have it, don’t have an account with sufficient privileges to reset it via SSMS, and most importantly, don’t have to stop the SQL services so processing can continue.
All you will need is psexec (in the sysinternals toolkit) available here à https://technet.microsoft.com/en-us/sysinternals/pxexec.aspx
Once the tools are extracted to a directory on the server:
Psexec.exe –s –i “{full path to the ssms.exe”}
This will start the SQL Management Studio as the NTSERVICE\SYSTEM account … enter the name of the SQL Server (or localhost) and then you’re in … reset the sa password in there
Another way
- Stop SQL Server Service
- Start is with
net start MSSQLSERVER /m"SQLCMD"
sqlcmd -SServerName\InstanceName
CREATE LOGIN RecoveryAcct WITH PASSWORD=’TempPass1’
GOSP_ADDSRVROLEMEMBER RecoveryAcct,SYSADMIN
GO
This was on Microsoft SQL Server 2008 (SP2) – 10.0.4067.0 (X64).