首页 > 开发 > 综合 > 正文

通过创建用户profile文件, 限制用户对数据库资源使用

2024-07-21 02:06:48
字体:
来源:转载
供稿:网友

可以限制的资源列表




在下面的例子中,创建一个供用户testuser使用的test_profile环境文件:



create profile test_profile limit



failed_login_attempts 3;



create user testuser identified by abcd1234



profile test_profile;



grant create session to testuser;



如果连续3次与testuser账户的连接失败,该账户将自动被oracle锁定。此后当输入testuser账户的正确口令时,会收到一条错误信息:



error:ora-28000: the account is locked



环境文件是通过“create profile”命令创建的,可以用“alter profile”命令修改。下例所示的“alter profile”命令用于修改现有的环境文件。在这个例子中,数据库的缺省环境文件被修改成允许最大空闲时间为1小时:



alter profile default 或 profile文件名   limit idle_time 60;

--设定用户的资源配置文件
1.设置初始化参数  resource_limit=true
2./*建立资源配置文件*/
create profile prfile_name limit session_per_user 2 cpu_per_session 10000 idle_time 60 connect_time 480;

3.alter user user_name profile profile_name;    --将创建的profile文件分配给用户

4.用命令修改资源配置文件
alter profile default 或 profile文件名   limit idle_time 60;

5.drop profile profile_name;    --删除profile

/*建立了profile后,且指定给某个用户,则必须用cascade才能删除*/
drop profile profile_name cascade;

alter system set resource_limit=true;---启用自愿限制,缺省是false










中国最大的web开发资源网站及技术社区,
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表