24

I have a non-admin login to an Oracle database, and I'd like to check when my password expires. I've found a lot of information online about getting password expiration dates by querying on the DBA_USERS table -- but I do not have privileges to view that table.

I'm hopeful that Oracle includes a way for me to check password expiration for my own login, but so far I've been unable to find any queries except those that reference the DBA_USERS table.

Is there a way for me to determine when my own password expires without putting in a ticket to the DBA?

3 Answers 3

54

You can see the current user details using

select * from USER_USERS;

That will have a column name "expiry_date" which has the data you ask for.

P.S. For almost every DBA_* there is an ALL_* (all the permitted records that the current user can see) and a USER_* (all the permitted records owned by the current user)

so DBA_TABLES has all the tables the systems has, ALL_TABLES has all the tables the current user has permissions to do something on (update, delete, insert, modify, etc), and USER_TABLES - all the tables the current user created.

4
  • 1
    Exactly what I needed. Thank you! (I can't accept the answer for 5 more minutes, but I will when I can.)
    – Joe DeRose
    Commented Oct 13, 2014 at 14:59
  • 1
    You're welcomed :) - I added a short explanation about the USER, ALL, and DBA prefixes.. might help you in the future :)
    – evenro
    Commented Oct 13, 2014 at 15:00
  • 1
    USER_USERS won't have PASSWORD and PROFILE information as compared to DBA_USERS. Commented Oct 13, 2014 at 15:15
  • 2
    select * from dba_users; shows all users the current user can see... if you are logged in as the DBA, for instance, this will show all database users. I know the answer says this, but as a non-expert Oracle user, this wasn't super clear, and I wasn't finding the info the OP mentioned. Instead I found this SO question and wanted the select * from dba_users; answer. So here it is.
    – Jason
    Commented Sep 22, 2021 at 15:14
5

Completing the previous answer

select USERNAME,EXPIRY_DATE from USER_USERS;

will give you the same result but with less clustered and easier to read output.

1

I have been looking for a very detailed answer to this question for quite some time and now I finally found an answer.

If you would like to know EXACTLY when your password expires, use this:

alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
select username, expiry_date from user_users where username='my_username';

You will get results not just in date, but also in exact time.

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