Wednesday, February 22, 2012

Oracle Database account unlocker

This is a simple procedure i created for unlocking user account and resetting the password to the original password, Although a very small utility it helps you with unlocking accounts that you tend to use after a long time which in my case were the SOA server and the BAM server user accounts.
CREATE OR REPLACE PROCEDURE "SYS"."ACCOUNT_UNLOCKER" ( p_user in varchar2 )
is
temp_password varchar2(255);
begin
select password into temp_password from sys.user$ where upper(name)=upper(p_user
);
execute immediate 'alter user '||p_user||' account unlock ' ;
execute immediate 'alter user '||p_user|| ' identified by values '''||temp_passw
ord||'''';
end;