Sunday, 31 May 2015

SA PASSWORD reset if you do not have any credential


When you are using MS SQL Server in mixed mode, it is very important that you know your SA password.
There can be different reasons you lost the password
·         Person who installed the SQL Server knows the password but has left the building.
·         You did not write down the password in your password file
·         Password file is lost
Steps to recover the SA password:

1.    Start SQL Server Configuration Manager

    2.    Stop the SQL services

    3.   Edit the properties of the SQL Service

    4.   Change the startup parameters of the SQL service by adding a –m; in front of the existing parameters.


    5. Start the SQL services. These are now running in Single User Mode

    6. Start CMD on tthe SQL server

    7. Start the SQLCMD command. Now you will see following screen.

    8.Now we create a new user. Enter following commands

            CREATE LOGIN crmuser WITH PASSWORD = 'hcl@123'

   CREATE LOGIN [Login_name] FROM WINDOWS WITH DEFAULT_DATABASE=[master]

 9.  Now we grant the user a SYSADMIN roles using the same SQLCMD window.
         
                        sp_addsrvrolemember ‘crmuser’, ‘sysadmin’
                        go

          EXEC master..sp_addsrvrolemember @loginame = 'login_name',
          @rolename = 'sysadmin'



10.  Stop the SQL service again


11.  Change the SQL service properties back to the default settings.

 12.  Start the SQL server and go via the security panel to the properties and change the password of the SA   
       account.

   ‘sa’ because the account is currently locked out:

  Fix/Solution/Workaround:

1.       Disable the policy on your system or on your domain level. However, this may not be the most 
       appropriate option as it will adversely affect your security protection level.

2.        If this is a one-time issue, enable “sa” login WITH changing password of “sa” login.

        ALTER LOGIN  sa  WITH PASSWORD = 'yourpass' UNLOCK ;
        GO

3.       If this is a one-time issue, enable “sa” login WITHOUT changing password of “sa” login.

       ALTER LOGIN sa WITH CHECK_POLICY = OFF;



No comments:

Post a Comment