SQL SERVER – Enable Login – Disable Login using ALTER LOGIN – Change name of the ‘SA’

In SQL SERVER 2005, all the login (including ‘sa’ ) can be enabled and disabled using ALTER LOGIN command. This is a very popular request quite a lot of time as a user want to secure their system administrator’s account ‘SA’. The best possible scenario is either to disable SA username or change it to some new username.

SQL SERVER - Enable Login - Disable Login using ALTER LOGIN - Change name of the 'SA' changesa

 

In this blog post we will learn how we can disable the SA login or disable the same. In this blog post we will also see that we can change the SA to a new name. Make sure that you change the new name in such fashion that users can’t guess them easily.

To disable ‘sa’ login:

ALTER LOGIN sa DISABLE
GO

To enable ‘sa’ login:

ALTER LOGIN sa ENABLE
GO

Also for additional security (prevent educated guess from hackers) the name of the ‘sa’ account can be changed.

ALTER LOGIN [sa] WITH NAME = [AdminUser]
GO

Well, that’s it. I can tell you that most of the database out there has either SA enabled with a simple password. It is our responsibility that we change the SA user to another name so potentially bad people can’t guess it easily.

Please leave your views in the comments section.

Reference: Pinal Dave (https://blog.sqlauthority.com)

, SQL Scripts, SQL Server, SQL Server Security
Previous Post
SQL SERVER – FIX : ERROR 1101 : Could not allocate a new page for database because of insufficient disk space in filegroup
Next Post
SQL SERVER – DBCC Commands to Free SQL Server Memory Caches

Related Posts

Leave a Reply