How to update oracle password with the same values

How to update oracle password with the same values

Problem

In this article, we will be looking at How to update oracle password with the same values. So as your organization’s D.B.A., you’ve received a request from the apps team stating that the application password has expired and they want the password to be reset and must remain the same as before.

 

Solution

11g

SELECT username, PASSWORD, 'alter user ' || username || ' identified by values ' || '''' || PASSWORD || '''' ||';' alter_user_sql FROM dba_users WHERE username = 'USERNAME';

Output:

 
ALTER USER USERNAME IDENTIFIED BY VALUES '38D7871CDFF83D1E';

OR

select spare4 from user$ where name='USERNAME';

12c

select u.username ,'alter user '||u.username||' identified by values '''||s.spare4||''';' alter_user_sql from dba_users u  join sys.user$ s on u.user_id = s.user#  where u.username = 'USERNAME';

The above script will produce an ALTER command, copy it and execute it to update the password by values.

Conclusion 

This will update the password with the same values.

e.g if the password was ABC123, after executing the script the password will be ABC123.