Blog

How to Backup user password before change and set old password if needed

In this post, We will try to understand how to take the backup of user password.

Oracle store the password in encrypted format.

Here we can see the hexadecimal password format get changed once we change the use password.

SQL> alter user PDBUSER identified by pdbuser;

User altered.


SQL> select spare4 from sys.user$ where name='PDBUSER';

SPARE4
--------------------------------------------------------------------------------
S:7C09E632006C60D371B234E2BF0A5D037029C54F18773D2B58F266BC2299;T:2F1D49B8963FF73
C7FBA6D715A610DD927007651EC41A8E0A69E70518566592DA5E0B060A3646E1399804C6C8C00055
4B0D11813225039216BD43A42C6C046FE1692714A522E7C13E2B2F082FB1F8D53

SQL> alter user PDBUSER identified by pdbpassword;

User altered.

SQL>
SQL> select spare4 from sys.user$ where name='PDBUSER';

SPARE4
--------------------------------------------------------------------------------
S:16F8EC03762A3167445BA3186867544BAE735B154397F77AD2521F63722B;T:ECB26C33C75F8B4
98F2E1949454D0A2F4C10396D109F77EDFCCB1B4D7D95259DF716D4D24532786303C4ED4161F1658
E92A312D47FBE91CAD1D8CE04F7E03A00630E68C98FD268DE1F0CE110EC5F38D0

Following query with VALUES will help you to keep the old password by specyfying password values.

SQL> alter user PDBUSER identified by values 'S:16F8EC03762A3167445BA3186867544BAE735B154397F77AD2521F63722B;T:ECB26C33C75F8B498F2E1949454D0A2F4C10396D109F77EDFCCB1B4D7D95259DF716D4D24532786303C4ED4161F1658E92A312D47FBE91CAD1D8CE04F7E03A00630E68C98FD268DE1F0CE110EC5F38D0';

User altered.

Open New terminal and try to connect with old user password.

[oracle@prim ~]$ sqlplus pdbuser/pdbpassword@pdbprim2

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jul 23 15:05:10 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Last Successful login time: Fri Jul 23 2021 14:59:30 +05:30

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

Follow me

Contact us for Training/ Job Support

Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.