Oracle database is the most widely used relational database management system. In the process of managing Oracle database, system administrators often face the problem of forgetting passwords. Especially if the Oracle system administrator forgets his or her password, this will result in the inability to log in to the database for management operations. In this case, without an effective solution, the system administrator will be unable to restore access to the database, which will affect the normal operations of the enterprise.
So, what should the Oracle system administrator do when he forgets his password? In this article, we will step by step analyze the reasons and solutions for Oracle system administrators forgetting their passwords to help you better restore access rights.
1. Reasons why Oracle system administrators forget their passwords
2. Solutions for Oracle system administrators who forget their passwords
Use SQL*Plus The tool can log into the Oracle database and then retrieve the initial password of the administrator account by modifying specific database tables.
The following are the steps to use SQL*Plus to reset the Oracle system administrator account:
1) Use SQL*Plus to log in to the Oracle database:
Enter sqlplus /nolog on the command line , and then enter the CONN/AS SYSDBA command at the prompt to log in to the database console.
2) Use the following command to find the administrator account:
Enter the following command to find the administrator’s account name:
SELECT username
FROM dba_users
WHERE user_id = ( SELECT user_id FROM dba_users WHERE UPPER(username) = 'SYS');
This will return the account name of the system administrator, usually SYS.
3) Modify the administrator password through the following command:
Enter the following command to change the password of a specific administrator:
ALTER USER sys IDENTIFIED BY new_password;
where , new_password is the new password the administrator wants to use.
4) Exit the SQL*Plus tool and log in again
The administrator should now exit the SQL*Plus tool and log in again to the Oracle system administrator account using the new password.
In some cases, the administrator may forget the database system administrator account and password. In this case, you can use Oracle Universal Installation (OUI) to reset the password of the Oracle administrator account.
The following are the steps to reset the Oracle administrator account password:
1) Stop the Oracle database
First, the administrator needs to stop the Oracle database in order to perform necessary operations. In the Unix/Linux operating system, you can use the following command to stop the Oracle database:
$ ORACLE_HOME/bin/sqlplus /NOLOG
SQL> CONNECT / AS SYSDBA
SQL> SHUTDOWN IMMEDIATE
SQL> EXIT
If you are using a Windows operating system, you can stop the Oracle service in the control panel.
2) Start single-user mode
Single-user mode is a new process in which the Oracle database can be restarted by changing the administrator password. Administrators can enter single-user mode using the following command:
$ ORACLE_HOME/bin/sqlplus /NOLOG
SQL> CONNECT / AS SYSDBA
SQL> STARTUP MOUNT EXCLUSIVE RESTRICT
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ; EXIT;
3) Reset the administrator password
Now, you can reset the password of the Oracle administrator account by executing the following command:
$ ORACLE_HOME/bin/sqlplus /NOLOG
SQL> CONNECT / AS SYSDBA
SQL> ALTER USER sys IDENTIFIED BY new_password;
SQL> ALTER USER system IDENTIFIED BY new_password;
This will set New passwords for two important accounts: sys administrator account and system administrator account.
4) Exit the Oracle database
Administrators should now exit single-user mode, restart the Oracle database, and log back into the administrator account using their new password. You can exit the Oracle database through the following command:
SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;
above The steps can solve the problem of Oracle database administrator forgetting password and allow the administrator to regain access to the database.
3. Prevent Oracle system administrators from forgetting their passwords
Forgetting your password is a common mistake, but this kind of mistake can be prevented. Here are some suggestions on how to prevent Oracle database administrators from forgetting their passwords:
Summary
When the Oracle database system administrator forgets the password, the administrator can reset the password of the administrator account by using SQL*Plus and OUI methods. Administrators can take precautions to avoid forgotten passwords. These include assigning independent, secure passwords, changing password policies, and establishing a disaster recovery plan. These measures will help administrators better manage Oracle databases and ensure that the system can run better.
The above is the detailed content of oracle sys forgot password. For more information, please follow other related articles on the PHP Chinese website!