--去年的时候写了一个存储过程,用来给开发自己解锁用户用
--先建一个单独的用户,然后创建解锁用户的procedure
--最后把这个procedure的权限赋给那个用户
--开发使用的时候只要自己登上解锁的用户,调用存储过程就能解锁想解锁的用户了
--存储过程如下:
create or replace procedure unlock_user(p_username varchar2)is
--user's status flg
v_exist varchar2(32);
begin
--select the user's account_status
select account_status
into v_exist
from dba_users s
where s.username =upper(p_username);
--Ensure the usesr is locked
if v_exist = 'LOCKED(TIMED)' then
--Try to unlock it
execute immediate 'alteruser ' || p_username || ' account unlock';
else
--Echo error msg
dbms_output.put_line('user ' || p_username ||' is notLOCKED(TIMED)');
end if;
end unlock_user;