oracle cursor


set serverout on;

DECLARE
CURSOR c_dept IS select distinct a.username, b.profile, b.resource_name, b.limit from dba_users a, dba_profiles b where a.profile = b.profile and a.profile is not null and b.resource_type = 'PASSWORD' and b.resource_name = 'FAILED_LOGIN_ATTEMPTS' and b.limit <> 'UNLIMITED' and a.username not in (select c.username from dba_users_with_defpwd c) and a.username not in ('SYS','SYSTEM','SYSMAN','MGMT_VIEW', 'ANONYMOUS', 'FLOWS_FILES', 'WKPROXY', 'WKSYS', 'FLOWS_030000', 'OLAPSYS', 'APEX_PUBLIC_USER');
vs_row2 c_dept%rowtype;
BEGIN
DBMS_OUTPUT.PUT_LINE('------------------------');
FOR vs_row2 IN c_dept
LOOP
-- DBMS_OUTPUT.PUT_LINE('Department:'|| vs_row2.profile||'-');
-- alter profile tet limit failed_login_attempts unlimited;
DBMS_OUTPUT.PUT_LINE('#############');
END LOOP;
END;
/


-- 带游标<br>create or replace procedure SP_Test is
DECLARE

cursor c_dept is select distinct a.username, b.profile, b.resource_name, b.limit from dba_users a, dba_profiles b where a.profile = b.profile and a.profile is not null and b.resource_type = 'PASSWORD' and b.resource_name = 'FAILED_LOGIN_ATTEMPTS' and b.limit <> 'UNLIMITED' and a.username not in (select c.username from dba_users_with_defpwd c) and a.username not in ('SYS','SYSTEM','SYSMAN','MGMT_VIEW', 'ANONYMOUS', 'FLOWS_FILES', 'WKPROXY', 'WKSYS', 'FLOWS_030000', 'OLAPSYS', 'APEX_PUBLIC_USER');
vs_row2 c_dept%rowtype;
tempresult varchar2(1024);

begin
for vs_row2 in c_dept loop
begin
tempresult := tempresult||vs_row2.profile;
DBMS_OUTPUT.PUT_LINE('#############'||tempresult);
alter profile 'test' limit failed_login_attempts unlimited;
end;
end loop;
end;
/



select distinct a.username, b.profile, b.resource_name, b.limit from dba_users a, dba_profiles b
where a.profile = b.profile and a.profile is not null and b.resource_type = 'PASSWORD' and b.resource_name = 'PASSWORD_LIFE_TIME'
and b.limit <> 'UNLIMITED' and a.username not in (select c.username from dba_users_with_defpwd c)
and a.username not in ('SYS','SYSTEM','SYSMAN','MGMT_VIEW', 'ANONYMOUS', 'FLOWS_FILES', 'WKPROXY', 'WKSYS', 'FLOWS_030000', 'OLAPSYS', 'APEX_PUBLIC_USER' , 'DBSNMP');



select distinct a.username, b.profile, b.resource_name, b.limit from dba_users a, dba_profiles b where a.profile = b.profile and a.profile is not null and b.resource_type = 'PASSWORD' and b.resource_name = 'FAILED_LOGIN_ATTEMPTS' and b.limit <> 'UNLIMITED' and a.username not in (select c.username from dba_users_with_defpwd c) and a.username not in ('SYS','SYSTEM','SYSMAN','MGMT_VIEW', 'ANONYMOUS', 'FLOWS_FILES', 'WKPROXY', 'WKSYS', 'FLOWS_030000', 'OLAPSYS', 'APEX_PUBLIC_USER');

alter profile PROFILE_DNADBM_XY_0115 limit failed_login_attempts unlimited;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值