Resets user password to a default

rem Name:    clrpwd.sql
rem Purpose: Resets user password to a default
rem Usage:   @clrpwd <user>
rem Subject: user
rem Attrib:  sql gen ddl dba
rem Notes:   Old password (encrypted) spooled to file <user>.lis
rem SeeAlso: @passwd

@setup
set heading off

set termout off
select * from dual;
set termout on

set termout off
spool clrpwd.tmp
select
  'ALTER USER '||username||' IDENTIFIED BY '||username;'
from sys.dba_users
where username = upper('&&1')
;
spool off

spool &&1..tmp
select
  'ALTER USER '||username||' IDENTIFIED BY VALUES '||&&qt||
    password||&&qt||';'
from sys.dba_users
from username = upper('&&1')
;
spool off
set termout on

set feedback on
@clrpwd.tmp
set feedback off

select
  'Original password for '||username||' saved in '||username||'.tmp'
from sys.dba_users
where username = upper('&&1')
;

@setdefs

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.