Where can i find the date and time when the last time password of oracle schema/user was changed
------------------------------------------------------------------------ The most enjoyable things in the world are either Immoral or too Expensive or otherwise Inaccessible anyway
The view dba_users has a column "expiry_date" which you can use to determane the date the password was changed, by using the profile information on "password_life_time" .
"expiry_date"(date) - password_life_time(days) should give you the result.
The view dba_users has a column "expiry_date" which you can use to determane the date the password was changed, by using the profile information on "password_life_time" .
Expiry_date column in dba_users will show the date for expired users, then what abt current open account users?????
Code:
USERNAME ACCOUNT_STATUS EXPIRY_DA LOCK_DATE
------------------------------ -------------------------------- --------- ---------
SYS OPEN
SYSTEM OPEN
DBSNMP OPEN
PS OPEN
BRUNTM OPEN
LEWISD OPEN
CRYSTAL OPEN
PEOPLE OPEN
OUTLN EXPIRED & LOCKED 22-SEP-05 22-SEP-05
WMSYS EXPIRED & LOCKED 22-SEP-05 22-SEP-05
ORDSYS EXPIRED & LOCKED 22-SEP-05 22-SEP-05
ORDPLUGINS EXPIRED & LOCKED 22-SEP-05 22-SEP-05
MDSYS EXPIRED & LOCKED 22-SEP-05 22-SEP-05
I found something bothersome.Look at the results from queries. The dba_ view is correct, but the sys.user$ expdate is wrong....
select t.username,t.expiry_date,
TO_date(t.expiry_date,'DD/MM/YYYY') - to_date(sysdate,'DD/MM/YYYY') "DAYS BEFORE EXPIRE"
from dba_users t
where t.username in('TEST_PROFILE','TEST_PROFILE_2')
USERNAME EXPIRY_DATE DAYS BEFORE EXPIRE
TEST_PROFILE_2 13/Nov/05 0224:33:23 PM 3
TEST_PROFILE 24/Nov/05 1024:45:20 AM 14
select name,ptime,exptime
from sys.user$
where name in ('TEST_PROFILE','TEST_PROFILE_2')
NAME PTIME EXPTIME
TEST_PROFILE_2 10/Nov/05 0224:33:23 PM 10/Nov/05 0224:31:16 PM
TEST_PROFILE 10/Nov/05 1024:45:20 AM
I found something bothersome.Look at the results from queries. The dba_ view is correct, but the sys.user$ expdate is wrong....
select t.username,t.expiry_date,
TO_date(t.expiry_date,'DD/MM/YYYY') - to_date(sysdate,'DD/MM/YYYY') "DAYS BEFORE EXPIRE"
from dba_users t
where t.username in('TEST_PROFILE','TEST_PROFILE_2')
USERNAME EXPIRY_DATE DAYS BEFORE EXPIRE
TEST_PROFILE_2 13/Nov/05 0224:33:23 PM 3
TEST_PROFILE 24/Nov/05 1024:45:20 AM 14
select name,ptime,exptime
from sys.user$
where name in ('TEST_PROFILE','TEST_PROFILE_2')
NAME PTIME EXPTIME
TEST_PROFILE_2 10/Nov/05 0224:33:23 PM 10/Nov/05 0224:31:16 PM
TEST_PROFILE 10/Nov/05 1024:45:20 AM
1. You are using TO_DATE() where you shouldn't (on DATE columns, like t.expiry_date and on sysdate) and on the other hand you don't use TO_CHAR() with appropriate format mask where you realy should (when displaying DATE columns).
2. You have some serious issues with your default date format mask - what kind of date is something like "10/Nov/05 0224:33:23 PM"
3. You should start using [ code ] tags to make results readable. This probably makes much more sense to readers:
Code:
NAME PTIME EXPTIME
TEST_PROFILE_2 10/Nov/05 0224:33:23 PM 10/Nov/05 0224:31:16 PM
TEST_PROFILE 10/Nov/05 1024:45:20 AM
4. You are comparing apples and owen toasters with the above two queries, so it is not realy clear what you thing is wrong with your results. Look at the source of the DBA_USERS view and you'll find out how DBA_USERS.EXPIRY_DATE is defined and that it is not based only on USER$. If you'll still find your results to be strange, then you'll have to post some more information about your two users - at least their relevant values from PROFILE$.
Jurij Modic ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Bookmarks