What should I do if I forget the password in the SQL or Oracle database?

Source: Internet
Author: User

When installing Oracle 9i, I forgot the password of the database administrator I just changed, and did not reinstall it. It was too troublesome. After trying for a long time, I finally succeeded in the modification.

1. Run it to the C root directory.

2. Enter: Set oracle_sid = your SID Name.

3. Input: sqlplus/nolog

4. Input: connect/As sysdba

5. Input: Alert user SYS identified by sys

6. Input: Alert user system identified by System

The password is the initial password of the Oracle database. For example:

Log on to the Enterprise Manager for query, analysis, and execution:
Exec sp_password null, 'your new password', 'sa'

If you install SQL Server under NT (including 2000), you can do this:
Directly open the "query analyzer" (note that it is not in the "Enterprise Manager", you can chooseProgramIf no isqlw.exe is found, enter "isqlw.exe" in "run );
Select "Windows Authentication". You do not need to enter the password. As long as you are the system administrator or domain administrator of your local computer, you will be the administrator of SQL Server;
In the query analyzer window, enter the following statement to change the SA password:
Sp_password null, \ 'OK \', \ 'sa \'
After running, the SA password changes to "OK"

The sp_password stored procedure is used to change the logon password of SQL Server;
Syntax format:
Sp_password [[@ old =] \ 'old _ password \ ',]
{[@ New =] \ 'new _ password \'}
[, [@ Loginame =] \ 'login \ ']
Parameter description
[@ Old =] \ 'old _ password \ ': old password;
[@ New =] \ 'new _ password \ ': the new password to be specified
[@ Loginame =] \ 'login \ ': user to be specified
Return Value: 0 (successful) or 1 (failed)

The key principle of the above method is to connect to SQL Server from the "query analyzer" with "Windows Authentication". As long as you are the system administrator or domain administrator of the local machine, it will automatically become the administrator of SQL Server.

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.