Statement to unlock Oracle user at command line

  • 2021-08-28 21:27:43
  • OfStack

In the daily work of DBA, we often encounter the operation of unlocking Oracle users. This article gives the command line for Oracle user unlocking operation methods, through a few simple unlocking statements can be completed. The following is the specific process:

The default scott user is locked, and you can log in after unlocking it first. Unlock scott with the following statement:


alter user scott account unlock; 

You may be asked for the password after unlocking:


alter user scott identified by tiger; 

Log in again:


sqlplus scott/tiger 

You can land

Oracle Locking and Unlocking User Commands


SQL> conn /as sysdba 
 Already connected.  
//scott  User does not set tieger Default password, login is not available  

How to lock users:


SQL> alter user test account lock; 

The user has changed.

-----test user logs in to database and fails.
C:\ > sqlplus test/test

ERROR:
ORA-28000: the account is locked

Oracle user unlocking method:


SQL> conn /as sysdba 
SQL> alter user test account unlock; 

The user has changed. This completes the user unlocking operation of Oracle.


Related articles: