ninesided
ninesided

Reputation: 23263

How do I get a list of locked users in an Oracle database?

I want to be able to list all of the users in a given database along with an icon that determines whether they are locked or not. The problem I'm having is querying the "locked" status for a given user, I though it might have been on all_users but it isn't. Can anyone point me in the right direction?

Upvotes: 37

Views: 204452

Answers (3)

gautham p
gautham p

Reputation: 143

This suits the requirement:

select username, account_status, EXPIRY_DATE from dba_users where 
username='<username>';

Output:

USERNAME        ACCOUNT_STATUS                   EXPIRY_DA
--------------------------------------------------------------------------------
SYSTEM          EXPIRED                          13-NOV-17

Upvotes: 2

sweetfa
sweetfa

Reputation: 5845

select username,
       account_status 
  from dba_users 
 where lock_date is not null;

This will actually give you the list of locked users.

Upvotes: 37

ninesided
ninesided

Reputation: 23263

Found it!

SELECT username, 
       account_status
  FROM dba_users;

Upvotes: 46

Related Questions