top of page

Rotating Application Database Passwords Without Downtime: Gradual Password Rollover Across Clouds

OmerNarman
Nov 6
7 min read

Security policy says application passwords must change every 90 days. In practice the change is painful: the moment the password changes in the database, every application server still holding the old one starts failing with ORA-01017. When those servers live in three places, a Kubernetes cluster in Azure, a VM pool in OCI and a batch server on premises, each managed by a different team, the rotation becomes a coordinated outage that everyone postpones.


Gradual password rollover removes the need for a single moment. After the change, the database accepts both the old and the new password for a period you choose. Each team updates its secret store and restarts its connections when it suits them, and the old password stops working automatically when the period ends.



The Use Case

The application account APP_USER is used by order-entry pods in Azure Kubernetes Service, an integration service on OCI VMs and a nightly batch server on premises. Each reads the password from its own secret store: Azure Key Vault, OCI Vault and a local credential file. The security team wants the password rotated without an outage, with proof that the old password no longer works afterwards.


Environment used in this runbook


  • Database: Oracle Database 19c (19.24), PDB SALESPDB on an OCI VM, with a Data Guard standby in Azure

  • Account: APP_USER, used by about 200 pooled connections from three locations

  • Secret stores: Azure Key Vault in Azure, OCI Vault in OCI, a protected file on the batch server

  • Rollover period: 24 hours

  • Licence: gradual password rollover is a standard database feature; no extra option is needed



How Gradual Password Rollover Works

  • A profile limit turns it on. PASSWORD_ROLLOVER_TIME in the user's profile sets how long both passwords stay valid after a change. It was introduced in 21c and is available in 19c from Release Update 19.12.

  • The change starts the period. When the password is changed with ALTER USER ... IDENTIFIED BY, the account enters the rollover state and both the old and the new password authenticate.

  • The period ends on its own. When the time is up, only the new password works. The DBA can also end it early, as soon as every client has switched.

  • Nothing changes for connected sessions. Existing connections stay connected; the password matters only when a new connection logs on.



Step 1: Check the Release and the Account's Profile

Confirm that the database is on a release that supports rollover, and find the profile the application account uses.


SQL

-- Connected to SALESPDB as a DBA

SELECT version_full FROM v$instance;

COLUMN username FORMAT A10

COLUMN profile FORMAT A12

COLUMN account_status FORMAT A20

SELECT username, profile, account_status,

TO_CHAR(password_change_date, 'YYYY-MM-DD') AS last_change

FROM dba_users

WHERE username = 'APP_USER';

Expected output

VERSION_FULL
-----------------
19.24.0.0.0

USERNAME   PROFILE      ACCOUNT_STATUS       LAST_CHANGE
---------- ------------ -------------------- -----------
APP_USER   DEFAULT      OPEN                 2026-08-04

What to expect: A release of 19.12 or later, and the account using the DEFAULT profile. Changing the DEFAULT profile would affect every user who has it, so give application accounts their own profile, as in the next step.



Step 2: Create a Profile for Application Accounts

Create a profile that sets the rollover period, together with the other password rules application accounts should follow. The rollover time is given in days; 1 means 24 hours.


SQL

CREATE PROFILE app_accounts LIMIT

PASSWORD_ROLLOVER_TIME 1

PASSWORD_LIFE_TIME UNLIMITED

FAILED_LOGIN_ATTEMPTS 10

PASSWORD_LOCK_TIME 1/24

PASSWORD_REUSE_MAX 12

PASSWORD_REUSE_TIME 365;

COLUMN resource_name FORMAT A24

COLUMN limit FORMAT A10

SELECT resource_name, limit

FROM dba_profiles

WHERE profile = 'APP_ACCOUNTS'

AND resource_name IN ('PASSWORD_ROLLOVER_TIME', 'FAILED_LOGIN_ATTEMPTS', 'PASSWORD_REUSE_MAX')

ORDER BY resource_name;

Expected output

Profile created.

RESOURCE_NAME            LIMIT
------------------------ ----------
FAILED_LOGIN_ATTEMPTS    10
PASSWORD_REUSE_MAX       12
PASSWORD_ROLLOVER_TIME   1

What this does: It creates a profile where a password change keeps the old password valid for one day. PASSWORD_LIFE_TIME is unlimited because application passwords are rotated on a schedule by the DBA, not expired by the database at an arbitrary moment. The other limits lock the account for an hour after 10 failed logons and stop the last 12 passwords from being reused.



Step 3: Assign the Profile to the Application Account

Assign the profile and confirm it took effect. The change applies from the next password change; nothing happens to existing connections.


SQL

ALTER USER app_user PROFILE app_accounts;

SELECT username, profile, account_status FROM dba_users WHERE username = 'APP_USER';

Expected output

User altered.

USERNAME   PROFILE      ACCOUNT_STATUS
---------- ------------ --------------------
APP_USER   APP_ACCOUNTS OPEN

What to expect: The account now uses APP_ACCOUNTS and is still OPEN. Because the database is a Data Guard primary, the profile and the assignment reach the standby in Azure through redo, so the same rules apply there after a switchover.



Step 4: Change the Password and Start the Rollover

Generate a strong password, change it in the database, and confirm the account is in the rollover state. From this moment both the old and the new password work.


Shell

# On a secure admin host: generate a 24-character password and keep it out of shell history

NEWPW=$(openssl rand -base64 24 | tr -d '/+=' | cut -c1-24)

printf '%s' "$NEWPW" > ~/.app_user_newpw && chmod 600 ~/.app_user_newpw

sqlplus -s / as sysdba <<EOF

ALTER SESSION SET CONTAINER = salespdb;

ALTER USER app_user IDENTIFIED BY "$NEWPW";

SELECT username, account_status FROM dba_users WHERE username = 'APP_USER';

EOF

Expected output

Session altered.

User altered.

USERNAME   ACCOUNT_STATUS
---------- --------------------
APP_USER   OPEN & IN ROLLOVER

What to expect: The status OPEN & IN ROLLOVER. Applications using the old password keep connecting normally; nothing has broken anywhere. The 24-hour clock has started. Keep the protected file until the check in Step 8, then delete it.



Step 5: Update the Secret Store in Each Cloud

Each team now writes the new password into its own secret store. Pass the value from a file or standard input, never as a command-line argument, so it does not appear in process lists or shell history.


Shell

# Azure: new version of the secret in Azure Key Vault

az keyvault secret set --vault-name kv-sales-prod --name app-user-db-password \

--file ~/.app_user_newpw --query "attributes.updated" -o tsv

# OCI: new version of the secret in OCI Vault, value passed in a JSON file

printf '{"secretContentContent": "%s"}' "$(base64 -w0 ~/.app_user_newpw)" > ~/.app_user_newpw.json

chmod 600 ~/.app_user_newpw.json

oci vault secret update-base64 \

--secret-id ocid1.vaultsecret.oc1.eu-frankfurt-1.example \

--from-json "file://$HOME/.app_user_newpw.json" \

--query 'data."lifecycle-state"' --raw-output

Expected output

2026-11-06T09:14:27+00:00
UPDATING

What this does: Both stores now hold a new version of the secret; the old version is still there, so rolling back is a matter of pointing at the previous version. The OCI secret moves from UPDATING to ACTIVE within a minute. The batch team replaces the password in its credential file, or better, in an Oracle wallet used with an external password store.



Step 6: Restart the Connection Pools, One Location at a Time

Applications read the secret when they create connections, so each location must restart its pool, or recycle its connections, to pick up the new password. Do one location at a time and watch the logons.


SQL

-- After each location restarts its pool: new logons per client machine since the password change

COLUMN machine FORMAT A22

SELECT machine,

COUNT(*) AS sessions,

TO_CHAR(MIN(logon_time), 'HH24:MI') AS first_logon

FROM gv$session

WHERE username = 'APP_USER'

GROUP BY machine

ORDER BY machine;

Expected output

MACHINE                  SESSIONS FIRST_LOGON
---------------------- ---------- -----------
aks-orders-pool-7d9f2          96 09:31
oci-integ-01                   44 10:02
oci-integ-02                   42 10:03
onprem-batch-01                 4 07:12

What to expect: The Azure pods and the OCI integration servers all logged on after the password change at 09:14, so they are using the new password. The batch server's sessions date from 07:12, before the change: it is still on the old password. Its next restart, tonight before the rollover period ends, will pick up the new one.


Tip: With unified auditing, a policy on LOGON actions for APP_USER records every logon with its client host and time. During a rollover it shows exactly which clients have connected since the change, even for short-lived connections that the query above can miss.


Step 7: End the Rollover Period Early

Once every location has switched, there is no reason to wait for the full 24 hours. End the rollover so that the old password stops working immediately.


SQL

ALTER USER app_user EXPIRE PASSWORD ROLLOVER PERIOD;

SELECT username, account_status FROM dba_users WHERE username = 'APP_USER';

Expected output

User altered.

USERNAME   ACCOUNT_STATUS
---------- --------------------
APP_USER   OPEN

What this does: It ends the rollover period: the account returns to OPEN and only the new password is valid. If you do nothing, the database does the same on its own when the 24 hours are up. Run this only after the last client, the batch server here, has connected with the new password.



Step 8: Prove the Old Password No Longer Works

The security review wants evidence. From an admin host, try to log on with the old password, then with the new one. Both passwords are read from protected files inside the SQL*Plus input, so neither appears on a command line.


Shell

# ~/.app_user_oldpw holds the previous secret version, ~/.app_user_newpw the new one

sqlplus -s /nolog <<EOF

CONNECT app_user/"$(cat ~/.app_user_oldpw)"@//sales-oci-db1.example.internal:1521/salespdb_app

CONNECT app_user/"$(cat ~/.app_user_newpw)"@//sales-oci-db1.example.internal:1521/salespdb_app

SELECT 'connected' AS result FROM dual;

EOF

Expected output

ERROR:
ORA-01017: invalid username/password; logon denied


RESULT
---------
connected

What to expect: The old password is refused with ORA-01017 and the new one connects. Delete the temporary password files (~/.app_user_oldpw, ~/.app_user_newpw and ~/.app_user_newpw.json) now, and record the date of the rotation in the change log. The previous secret versions in Azure Key Vault and OCI Vault can be disabled once no client uses them.



Step 9: Make Rotation Routine

With rollover in place, rotation becomes a small, repeatable job rather than a project. Write down the order so any DBA can run it:


  • Change the password in the database (Step 4); the account enters rollover.

  • Update each secret store (Step 5).

  • Restart or recycle the pools, one location at a time (Step 6), and confirm the logons.

  • End the rollover early once all clients have switched (Step 7), or let it expire.

  • Verify the old password fails (Step 8) and clean up the temporary copies.


Keep the rollover period short: long enough for every team to restart once in normal hours, and no longer. A shorter period means a stolen old password stops working sooner.



Summary

Gradual password rollover turns a coordinated outage into a calm, staged change. Check that the database is on 19.12 or later, give application accounts their own profile with PASSWORD_ROLLOVER_TIME, and change the password to start the rollover. Update the secret stores in each cloud from a file rather than the command line, restart the connection pools one location at a time and watch the logons, then end the rollover early with EXPIRE PASSWORD ROLLOVER PERIOD. Finally, prove that the old password is refused and clean up, and the next rotation becomes a routine half-hour job.

Recent Posts

See All

Comments


bottom of page