Google it ....

Monday, March 24, 2014

How to re-open expired oracle database account without change password

Today I'll show you how to reopen Oracle database user account without changing password, which have status expired. Let's create demonstration:
create user
CREATE USER test IDENTIFIED BY test;
grant create session to test;

check status
SELECT username, account_status, expiry_date
 FROM dba_users
 WHERE username = 'TEST';
------------------------------------------- 
USERNAME ACCOUNT_STATUS EXPIRY_DATE
TEST  OPEN         20-Sep-14 11:29:00

expire it
alter user test password expire;

re-check status
SELECT username, account_status, expiry_date
 FROM dba_users
 WHERE username = 'TEST';
-------------------------------------------
USERNAME ACCOUNT_STATUS EXPIRY_DATE
TEST  EXPIRED 24-Mar-14 11:31:50

get the existing password, here is two method:
in 11g
select password from user$ where name='TEST';
PASSWORD
------------------------------
7A0F2B316C212D67

in 10g
select password from dba_users where username='TEST';
PASSWORD
------------------------------
7A0F2B316C212D67

open account with command
alter user test identified by values '7A0F2B316C212D67';

Or with command

SELECT DBMS_METADATA.get_ddl ('USER', 'TEST')
FROM DUAL;
-------------------------------------------
CREATE USER "TEST" IDENTIFIED BY VALUES
'S:79B1417837DCF0FBFACEFB10D7DBDC7B7EA63CC986036567BDCBA144B940;7A0F2B316C212D67'
 DEFAULT TABLESPACE "USERS"
 TEMPORARY TABLESPACE "TEMP"
 PASSWORD EXPIRE

edit above script and execute it
ALTER USER "TEST" IDENTIFIED BY VALUES
'S:79B1417837DCF0FBFACEFB10D7DBDC7B7EA63CC986036567BDCBA144B940;7A0F2B316C212D67'

chek status again
SELECT username, account_status, expiry_date
 FROM dba_users
 WHERE username = 'TEST';
-------------------------------------------
USERNAME ACCOUNT_STATUS EXPIRY_DATE
TEST  OPEN         20-Sep-14 11:36:47

after that user test still have its old pass test.
that's all, good luck.

2 comments: