Run the SQL statement below to expire an account:
SQL> ALTER USER <username> PASSWORD EXPIRE;
Example:
1 2 3 4 5 | SQL> conn sys/orcl@to_primary as sysdba Connected. SQL> alter user mereba password expire; User altered. SQL> |
Expiring an account’s password means when user tries to login he/she will be forced to change the password.
Now, lets try to login through the expired account above:
1 2 3 4 5 6 7 8 9 | SQL> conn mereba/mereba@to_primary ERROR: ORA-28001: the password has expired Changing password for mereba New password : Retype new password : Password changed Connected. SQL> |
Note: when we create a database there many users created by default. It is recommended to lock the accounts and expire their passwords if we are not currently using them.
Amen Edited answer 19/02/2022