Labels

Friday 10 February 2017

How to recover access to a SQL Server instance without downtime ?

Issue : 

Starting with SQL Server 2008, the local Administrators group is no longer added by default during SQL Server setup or forgotten the sa password then you can be completely locked out of your own SQL Server instance.
Situation :
 I've seen cases where an employee has moved on, but their Windows account, being the only one with Administrator privileges for SQL Server, had been completely obliterated from the system. Of course that person was the only one who knew the sa password as well, and being a local admin or even a domain admin might not help you.
Solution
you can use PSExec to gain access without restarting the SQL server instance.
Step 1 :  Check whether execution policy is enabled in power shell or not ? If execution policy is not enabled then enable it as shown in the below screen.



Step 2: Now new window will open then click on Agree










Step 3: Now SSMS window will open .

Step 4 : Connect to SQL Server instance and then add admin group or you domain account. 

Step 5 : Now you should be the administrator for that instance . Close SSMS and reopen and you can continue your DBA activities.