Skip to main content

Users, status and profiles

When to use it

When a user cannot log in, when you are asked whether an account exists, or during an access review.

Run this

Starter query written for this guide:

SELECT username, account_status, profile,
       TO_CHAR(created,     'YYYY-MM-DD') AS created,
       TO_CHAR(expiry_date, 'YYYY-MM-DD') AS expires,
       TO_CHAR(lock_date,   'YYYY-MM-DD') AS locked_on
FROM   dba_users
WHERE  username = UPPER('<USERNAME>');

To list every account that is not open:

SELECT username, account_status, lock_date, expiry_date
FROM   dba_users
WHERE  account_status <> 'OPEN'
AND    oracle_maintained = 'N'
ORDER  BY username;

How to read the output

  • OPEN is a usable account.
  • LOCKED(TIMED) means too many failed logins; it unlocks by itself after the time set in the profile.
  • LOCKED was locked by an administrator.
  • EXPIRED or EXPIRED(GRACE) means the password must be changed.
  • The profile holds the password rules that apply to the account.

What to do next

  • Unlocking or resetting a password is a change with a security impact. Follow the access request process of your team; never do it on a verbal request.
  • An application account that keeps getting LOCKED(TIMED) usually has an old password stored somewhere. Find the source before you unlock it again.

Risk level

READ ONLY Safe to run at any time. It only queries the data dictionary.