日期:2014-05-17  浏览次数:21301 次

oracle批量修改用户密码,密码已加密
如题:oracle批量修改用户密码,密码已加密


请各位多多指教!

------解决方案--------------------
用plsql块吧:

SQL code
declare
   cursor c1 is select username,password from dba_users;
   v_name varchar2(200);
   v_pwd varchar2(200);
begin
   open c1;
   loop
       fetch c1 into v_name,v_pwd;
       exit when c1%notfound;
       --修改密码
       update dba_users set password='密码' where username=v_name;
       commit;
   end loop;
   close c1;
end;

------解决方案--------------------
SQL code
--不要随便修改系统字典表,可使用动态SQL
DECLARE
  pass VARCHAR2(20) := 'aaa';--你的密码
BEGIN
  FOR c IN (SELECT t.username FROM dba_users t) LOOP
    EXECUTE IMMEDIATE 'alter user ' || c.username || ' identified by ' || pass;
  END LOOP;
END;
/