ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 通过创建用户profile文件,限制用户对数据库资源使用

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

原创 Linux操作系统 作者:sunnily 时间:2019-06-22 21:51:08 0 删除 编辑

在下面的例子中,创建一个供用户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


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/77580/viewspace-212725/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 导出表空间
请登录后发表评论 登录
全部评论

注册时间:2004-04-19

  • 博文量
    139
  • 访问量
    125829