15

I can use following statement to unlock an account:

ALTER USER username ACCOUNT UNLOCK

But which statement can I use to verify that account is currently locked out?

21

As Dba's answer already shows, account status information is accessible via the dba_users view. Connected with a user having the appropriate grants, this can also be used to identify "inactive users":

SELECT username, account_status, created, lock_date, expiry_date
  FROM dba_users
 WHERE account_status != 'OPEN';

tells you for each locked/expired account when it was created, which state it is in (locked, expired, expired and locked, expired(grace)), and what time it was locked or expired. Useful for a "cleanup"; but you should consider that some accounts might just be "data holders" which are never connected to for security reasons, but required either by Oracle itself or your application(s). A good example for those is the system account OUTLN. So take care to only "clean out" accounts you know are not used/needed :)

5

Use DBA_USERS View.

SELECT username, account_status
FROM dba_users;
1

You can query this by specifying the username also:

select username, account_status
from dba_users
where username = 'your_user_name';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.