How to retrieve the sa user password

Source: Internet
Author: User

How to find the password of the SQL Server sa user

Query Analyzer. During connection, authentication uses "use windows Authentication"

Then, execute:

The code is as follows: Copy code

EXEC sp_password NULL, 'newpassword', 'sa'

Enterprise Manager --> instance name --> Security --> login --> double-click SA on the right --> Change password

Solution to SQL Server SA user password loss

User operation errors cause password loss. There are two methods:

If there is not much data, you can reinstall the TNSDB database. If you only want to find the password, you can

The code is as follows: Copy code

Insert

Tns_secu_user (c_user_name, c_user_pwd, c_user_code, I _user_type,

C_expiry_date, c_user_lock, c_user_disa, c_who_crea, c_when_crea,

C_who_modi, c_when_modi) values ('sa ', 'c12e01f2a13ff5587e1e9e4aedb1_2d', '', 1,'', '1', '1 ','','','', '')

%. The "c12e01f2a13ff5587e1e9e4aedb00002d" string after 'sa "is the sa password.

Replace the sa password in the tns_secu_user table in the tnsdb library with him. The field is c_user_pwd.


Methods provided by other friends

Run the following command: exec sp_password null, 'New password', 'sa'
Now the password has changed. Go to the enterprise manager.
The storage process sp_password is described in SQL Server help:
Sp_password: add or change the password for logging on to Microsoft® SQL Server™.
Syntax:
Sp_password [[@ old =] 'old _ password',] {[@ new =] 'NEW _ password'} [, [@ loginame =] 'login']
Parameters:
[@ Old =] 'old _ Password' is the old password. Old_password is of the sysname type, and its default value is NULL.
[@ New =] 'NEW _ Password' is the new password. New_password is of the sysname type and has no default value. If the name parameter is not used, you must specify old_password.
[@ Loginame =] 'login' is the login name affected by the password change. Login is of the sysname type, and its default value is NULL. Login must already exist and can only be specified by members of the sysadmin fixed server role. The return code value is 0 (successful) or 1 (failed). Note that the SQL Server password can contain 1 to 128 characters, including any letters, symbols, and numbers. The new password is updated and stored in encrypted form. Therefore, no user (or even System Administrator) can view the password. When members of sysadmin or securityadmin fixed server roles use sp_password with all three parameters to reset their own passwords, the review records reflect that they are changing others' passwords. Sp_password cannot be used for Microsoft Windows NT® security accounts. Users who connect to SQL Server through a Windows NT network account are authorized by Windows NT, so their passwords can only be changed in Windows NT. Sp_password cannot be executed in a user-defined transaction. The permission execution permission is granted to the public role by default for users to change their logon passwords. Only members of the sysadmin role can change the logon password of other users. Example A. If you do not have the original password, change the password of Victoria to OK. EXEC sp_password NULL, 'OK', 'Victoria 'B. Change the password in the following example to change the password for logging on to Victoria from OK to coffee. EXEC sp_password 'OK', 'coffee'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.