snippetMajor
How to get a list of locked accounts / check that account is locked?
Viewed 0 times
lockedaccountgetthathowlistcheckaccounts
Problem
I can use following statement to unlock an account:
But which statement can I use to verify that account is currently locked out?
ALTER USER username ACCOUNT UNLOCKBut which statement can I use to verify that account is currently locked out?
Solution
As Dba's answer already shows, account status information is accessible via the
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
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 :)Code Snippets
SELECT username, account_status, created, lock_date, expiry_date
FROM dba_users
WHERE account_status != 'OPEN';Context
StackExchange Database Administrators Q#52641, answer score: 31
Revisions (0)
No revisions yet.