Wednesday, February 11, 2009

Simple random password generator for Oracle

#first character lower case alphabetic
#second character upper case alphabetic
#third character numeric
#characters 5-8 random alphanumeric

select 'alter user '||username||' identified by '||
chr(trunc(dbms_random.value*10)+100)||
chr(trunc(dbms_random.value*10)+65)||
trunc(dbms_random.value*10)||
dbms_random.string('x', 5)||';'
from dba_users where profile in ('BI_PROFILE','APPLICATION_PROFILE');