Oracle Profile 配置文件
Profile是用户的配置文件,它是密码限制,资源限制的命名集合。利用profile 可以对数据库用户进行基本的资源管理,密码管理。
1 创建profile 的语法
create profile profile_test1 limit
failed_login_attempts 3
password_lock_time 1
password_life_time 90
password_reuse_time 90
sessions_per_user unlimited
cpu_per_session unlimited
cpu_per_call 1000
connect_time 30
logical_reads_per_session default
logical_reads_per_call 1000
composite_limit 6
private_sga 128k;
(1) 对数据库资源做限制
sessions_per_user 每个用户名所允许的并行会话数
cpu_per_session 一个会话一共可以使用的cpu时间,单位是百分之一秒
ccpu_per_call 一次sql调用(解析、执行和获取)允许使用的cpu时间
connect_time 限制会话连接时间,单位是分钟
idle_time 允许空闲会话的时间,单位是分钟
logical_reads_per_session 限制会话对数据块的读取,单位是块
logical_reads_per_call 限制sql调用对数据块的读取,单位是块
composite_limit 指定一个会话的总的资源消耗,以service units单位表示
private_sga 限制会话在sga中shared pool中私有空间的分配
(2) 对密码做限制
failed_login_attempts 帐户被锁定之前可以错误尝试的次数
password_life_time 密码可以被使用的天数,单位是天,默认值180天
password_reuse_time 密码可重用的间隔时间(结合password_reuse_max)
password_reuse_max 密码的最大改变次数(结合password_reuse_time)
password_lock_time 超过错误尝试次数后,用户被锁定的天数,默认1天
password_grace_time 当密码过期之后还有多少天可以使用原密码
password_verify_function 该字段允许将复杂的PL/SQL密码验证脚本做为参数传递到create
2 创建用户指定profile
create user test2 identified by 123456
default tablespace default_tablespace
temporary tablespace temp
profile profile_test1;
查询创建的profile 对于资源与密码使用策略
select *
from dba_profiles
where profile='PROFILE_TEST1';
grant create session to test2;
此时用户对于密码与资源使用限制会遵循profile_test1,我们可以测试一下,连着输错3次密码,用户被锁
3 修改用户对应的profile
alter user test1 profile profile_test1;
4 修改profile
alter profile profile_test1 limit
cpu_per_session 10000
sessions_per_user 10
failed_login_attempts 5
password_grace_time 5
password_lock_time 3;
5 删除profile
drop profile profile_test1 cascade;
删除profile文件之后,使用这个profile的用户将自动重新指定default profile配置文件。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?