Sometimes you need to unlock an Oracle DB account without resetting its password. The “DBMS_metadata” utility package can be used to retrieve the password hash in order to unlock the DB account. We are going to see how I used it in this tutorial.

I was starting up the Oracle BI servers this morning when I get a “Failed to start one or more Servers (return 3)” error message:

Bummer :-/ Everything was working perfectly before and I had not modified the server configuration recently. I was scratching my head and decided to check for any “ORA” error messages in the “AdminServer.out” file:

The origin of the problem was clearly identified by the “java.sql.SQLException: ORA-28001: the password has expired” lines: some DB accounts password had expired. I remembered that I had modified the “system” DB account password after receiving an “ORA-28002: the password will expire within 7 days” warning message a few weeks ago. Surely the same thing was occurring now to the Oracle DB accounts used by the Oracle BI Server installation. You can see how I created an Oracle 19c DB user profile to turn off password expiration in this page.
I used sqlplus to connect to the Oracle DB instance as a sysdba. I selected the PDB used by the Oracle BI server and I queried for any “BI” (the prefix I chose during the installation) user with an expired password:

As you can see in the previous screenshot, seven “BI” DB users accounts had an expired password. This is commonly solved by unlocking the DB accounts with new passwords. Unfortunately these accounts had been created during the Oracle BI Server initial installation and configuration and I was not sure about how to update the Oracle BI Server configuration with the new passwords. An other solution could be to unlock these accounts by reusing their current passwords. But it would have required to know the passwords.
Fortunately there was an other solution: I could use “DBMS_METADATA.GET_DDL()” to retrieve the database accounts definitions including the password hashes. I could later use these hashes to alter the accounts without knowing their passwords. I wanted to store the information into a text file in order to be able to use it. I changed the following settings to avoid the hashes to be stored into multiple lines and I spooled the sqlplus statements output into the BI_USERS.txt file.

I executed the “select DBMS_METADATA.GET_DDL(‘USER’, ‘username’) from dual;” statement for the seven locked “BI” database accounts. The string after the “IDENTIFIED BY VALUES” correspond to the password hash:

I opened the BI_USERS.txt file that had been generated with an editor and I copied the “CREATE USER … IDENTIFIED BY VALUES” lines with the password hashes into a new file I named “ALTER_BI_USERS.sql“.

I replaced the “CREATE USER” statements by “ALTER USER” statements in this file and I saved it as ALTER_BI_USERS.sql.

I executed the file as SYSDBA to unlock the seven BI users by reusing the current password hash.

I checked that the accounts were effectively unlocked:

I decided to associate these accounts with the NOPWDEXPIRATION profile I had created in a previous tutorial in order to avoid the accounts passwords to expire in the future. I created a small ALTER_BI_USERS_PROFILE.sql file with “ALTER USER … PROFILE C##NOPWDEXPIRATION;” statements to assign this profile to the “BI” accounts:

I executed the file as SYSDBA:

I restarted the Oracle BI servers and after a few minutes I had the confirmation that they had been started successfully this time:

I opened a Web Browser and I connected to Oracle BI Analytics to perform a final check:

Everything was working fine once again, great!
Conclusion: do not forget to disable the password expiration policy for the BI DB accounts created during the installation and configuration of an Oracle BI Server!
Disclaimer
The post How to unlock an Oracle DB account without changing its password appeared first on MyBIJourney