Saturday, April 4, 2009

Recover sysadmin account for SQL 2005/2008

I accidently removed the the sysadmin account from the development machine and was stuck for a while, however the solution is quite simple (someone else took the credit):
start sql in single user mode by appending ';-m' to start-up paramaters throught configuration manager;
stop all other sql related service other than db engine;
run sqlcmd -E
run 'create login [contoso\administrator] from windows;
run 'EXEC sp_addsrvrolemember 'CONTOSO\administrator', 'sysadmin';
remove ;-m
restart sql db engine
done!!!

No comments:

Disable Microsoft Defender for Cloud for Visual Studio Subscription (MSDN)

I use a visual studio pro subscription which comes with $150 azure cloud credit, for some reason Microsoft Defender for Cloud was turned on ...