Search This Blog

Total Pageviews

Wednesday, 17 August 2016

How to re-open expired or EXPIRED(GRACE) Oracle database account without changing the password .

How to re-open expired or EXPIRED(GRACE)  Oracle database account without changing the password 



Oracle open a account without changing password for EXPIRED(GRACE) .
oracle EXPIRED(GRACE)
Oracle password EXPIRED
oracle ACCOUNT_STATUS EXPIRED(GRACE)
oracle ACCOUNT_STATUS EXPIRED




set linesize 200 pagesize 200 
col username for a20
select USERNAME,EXPIRY_DATE,ACCOUNT_STATUS from dba_users 
where 1=1 
and USERNAME like 'ANUJ%';



USERNAME EXPIRY_DATE ACCOUNT_STATUS
-------------------- -------------------- --------------------------------
ANUJ Feb-12-2017 03:06:30 OPEN
ANUJ1 Aug-17-2016 05:23:26 EXPIRED <<<<<----- 



ANUJ1 account is expired .


Run following Sql to create a sql 

set linesize 2000 longchunksize 300 long 5000 pagesize 0
select 'alter user ' || su.name || ' identified by values' || ' ''' || spare4 || ';' || su.password || ''';'
from sys.user$ su , dba_users du 
where su.name = du.username
and username='ANUJ1'
-- and ACCOUNT_STATUS like '%GRACE%' ;


execute this sql ..

alter user ANUJ1 identified by values 'S:B14311128BF87FFD1643BEF65E94695CAE0AF024E2A19A1EDF939E4DB739;H:895AC434525B471C4EAFEDDCE7A92E68;T:83572A338D2763FE2DDBF96C865557E58B916A1CD9EABA882E2FFF48C4CD69DA08B10582D0AD4FE3DC5CAC43322492C786B47C2BD12F3BA7136065D636BA9A8159AD3EB71BEFC2D754E253D09E5E849C;4A4D264BE7A4FEB0';


User altered.


set linesize 2000 longchunksize 300 long 5000 pagesize 0
select 'alter user ' || su.name || ' identified by values' || ' ''' || spare4 || ';' || su.password || ''';'
from sys.user$ su , dba_users du
where su.name = du.username
--and username='TEST'
-- and ACCOUNT_STATUS like '%GRACE%'
and spare4 like 'S:%'
order by name
;




======
set pagesize 0 linesize 300
SELECT 'alter user ' || name
|| ' identified by values '''
|| spare4
|| ';'
|| password
|| ''''
|| ' Account unlock;'
FROM sys.user$
WHERE name IN (SELECT username
FROM dba_users
WHERE 1=1
-- default_tablespace NOT IN ('SYSTEM', 'SYSAUX')
AND account_status = 'OPEN'
and ORACLE_MAINTAINED='Y'
)
--AND spare4 IS NOT NULL
--AND password IS NOT NULL
;
set pagesize 80 linesize 80
=====
Now user is alerted with old password 



Now Check the status is open ...



set linesize 200 pagesize 200 
col username for a20
select USERNAME,EXPIRY_DATE,ACCOUNT_STATUS from dba_users 
where 1=1 
and USERNAME like 'ANUJ%';


USERNAME EXPIRY_DATE ACCOUNT_STATUS
-------------------- -------------------- --------------------------------
ANUJ Feb-12-2017 03:06:30 OPEN
ANUJ1 Feb-13-2017 05:36:06 OPEN <<<<<----


set echo off head off verify off feedb off pages 0 long 10000 longchunk 10000 trimspool on lines 2000 timing off term off exec dbms_metadata.set_transform_param(dbms_metadata.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE); exec dbms_metadata.set_transform_param(dbms_metadata.SESSION_TRANSFORM,'PRETTY',TRUE); select 'alter user '||username||' identified by values '||REGEXP_SUBSTR(DBMS_METADATA.get_ddl ('USER',USERNAME), '''[^'']+''')||';' ddl from dba_users where username='ANUJ' /

xxx set pagesize 0 set long 150 set linesize 150 set longchunksize 150 col PASSWORD_VERSIONS for a15 select PASSWORD_VERSIONS,'alter user '||username||' identified by values '||REGEXP_SUBSTR(DBMS_METADATA.get_ddl ('USER',USERNAME), '''[^'']+''')||';' from dba_users where 1=1 and username='ANUJ' / set pagesize 150 PASSWORD_VERSIONS ----------------- 'ALTERUSER'||USERNAME||'IDENTIFIEDBYVALUES'||REGEXP_SUBSTR(DBMS_METADATA.GET_DDL('USER',USERNAME),'''[^'']+''')||';' ------------------------------------------------------------------------------------------------------------------------------------------------------ 11G 12C alter user ANUJ identified by values 'S:C728E3655459AE005D46D1B6F1F23D062A863716B54C98AFE8DA85884A49;T:88B3B41030B14C237194C358149B221051ECE8045852BB9

Oracle DBA

anuj blog Archive