SQL Server Access

Thanks to Graham Brown our resident SQL server guru for this - thought it is worth sharing.

This has happened a few times where SQL instances have been built or cloned by ‘other’ people – who then forget about who is meant to be supporting the instances … or just  go on holiday  ðŸ˜Š

 No Dba access

 If we cannot get access with our windows logins you can force your way in via Single User mode & SQLCMD

 See this :

https://www.sqlshack.com/recover-lost-sa-password/

Once you have gained access yourself please remember to add all the other DBA’s in the team… you know it makes sense!

If you have done the step above and still cannot log on – check the error log

(C:\Program Files\Microsoft SQL Server\MSSQL13.DYNAMICS_CRM_SQL\MSSQL\Log\errorlog for example)  – in the case of the instance I could see this just after the startup :

 2020-09-29 08:14:27.92 Server      Authentication mode is WINDOWS-ONLY.

 And then after I had tried to log on as the NewSA user created previously – and failed – in the log I could see this :

 2020-10-05 03:47:20.42 Logon       Login failed for user 'NewSA'. Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only. [CLIENT: <local machine>]

Basically whoever has created the instance has left it at ‘Windows only authentication’  - now although I can understand this depending on the application the instance is being used for it it’s a pain when we have the lack of login issue … and without the ability to use SSMS to change it to ‘SQL Server and Windows Authentication’ we have to hack the registry :

 https://www.top-password.com/knowledge/sql-server-authentication-mode.html

 One last thing - lately I have found is that people are not setting the SQL Server Network Configuration protocols correctly – for anybody to connect via a client / network connection the TCP/IP protocol must be enabled (as well as Allow Remote Connection to this server obviously) – this is found in SQL Server Configuration Manager and when done correctly looks like this :