正德厚生,臻于至善

使用apps修改web登陆最终用户密码为随机8位密码(除SYSADMIN,SETUP,ASADMIN外)--生产环境禁止执行

DECLARE
   l_dbname varchar2(20);
   P_INIT_PASSWORD VARCHAR2(30);
   l_change_flag VARCHAR2(10);
   l_reason varchar2(2000);
BEGIN
   select name into l_dbname from v$database;
   if l_dbname not like '%PROD' then
      update fnd_user f set f.user_guid=''  where f.user_guid is not null;
      commit;
      for rec in (select user_name from fnd_user f where f.user_id > 1110 and f.user_name not in ('SYSADMIN','SETUP','ASADMIN'))
        loop
           select dbms_random.string('x',8) into P_INIT_PASSWORD from dual;
           l_change_flag := fnd_web_sec.change_password(rec.user_name,P_INIT_PASSWORD);
           IF L_change_FLAG = 'Y' THEN  
              COMMIT;
              DBMS_OUTPUT.PUT_LINE('成功初始化用户('||rec.user_name||')的密码为:'||P_INIT_PASSWORD);
           ELSE
              rollback;
              l_reason := fnd_message.get;
              fnd_message.set_name('FND', 'FND_CHANGE_PASSWORD_FAILED');
              fnd_message.set_token('USER_NAME', rec.user_name);
              fnd_message.set_token('REASON', l_reason);
              app_exception.raise_exception;
           END IF;
        end loop;
   end if;
END;
/
赞(0) 打赏
未经允许不得转载:徐万新之路 » 使用apps修改web登陆最终用户密码为随机8位密码(除SYSADMIN,SETUP,ASADMIN外)--生产环境禁止执行

评论 抢沙发

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫

微信扫一扫

登录

找回密码

注册