Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Password generator
Dick,
this is what we use ... you can change to suit your needs. BTW unless enclosed in double-quotes, oracle passwords are case-insensitive, so capital letters is a moot point IMO.
PROCEDURE Generate ( USERID VARCHAR2 ) IS
newpass varchar2(20);
dbname varchar2(10);
BEGIN
dbms_output.enable(100000);
newpass := dbms_random.string('U',4)||TO_CHAR(SYSDATE,'SS')||DBMS_RANDOM.STRING('U',2);
execute immediate 'alter user '||USERID||' identified by '||newpass;
select name into dbname from v$database;
dbms_output.put_line('The new password for '||USERID||' is
'||newpass||' in the '||dbname||' database.'); execute immediate 'alter user '||USERID||' password expire'; execute immediate 'alter user '||USERID||' account unlock'; EXCEPTION WHEN NO_DATA_FOUND THEN Null; WHEN OTHERS THEN -- Consider logging the error and then re-raise RAISE;
Raj
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Mar 22 2005 - 06:43:26 CST