Oracle profile参数文件介绍

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:259

Oracle profile参数文件介绍一、profile说明 Oracle系统中的profile可以用来对用户所能使用的数据库资源进行限制,使用Create Profile命令创建一个Profile,用它来实现对数据库资源的限制使用,如果把该profile分配给用户,则该用户所能使用的数据库资源都在该profile的限制之内。
二、profile管理 Proflie是口令限制,资源限制的命名集合.建立oracle数据库时,oracle会自动建立名为DEFAULT的PROFILE,初始化的DEFAULT没有进行任何口令和资源限制.2.1、注意事项 1,建立PROFILE时,如果只设置了部分口令或资源限制选项,其他选项会自动使用默认值(DEFAULT的相应选项)2,建立用户时,如果不指定PROFILE选项,oracle会自动将DEFAULT分配给相应的数据库用户.3,一个用户只能分配一个PROFILE.如果要同时管理用户的口令和资源,那么在建立PROFILE时应该同时指定口令和资源选项.4,使用PROFILE管理口令时,口令管理选项总是处于被激活状态,但如果使用PROFILE管理资源,必须要激活资源限制.5,profile分两部分,resource_limit为true限定 资源参数(resource parameters) 设置有效,密码参数(passwordparameters)设置始终有效,不管resouce_limit的值为true或false.
2.2、创建条件 创建profile必须要有CREATE PROFILE的系统权限。可以创建不同的资源限制,最好将ALTER SYSTEM SET RESOURCE_LIMIT=TRUE。
写在init文件中:RESOURCE_LIMIT=TRUE ,不然下次启动可能失效。1.动态地使用alter system或使用初始化参数resource_limit使资源限制生效。该改变对密码资源无效,密码资源总是可用。SQL> show parameter resource_limit;SQL> alter system set resource_limit=true;SQL> show parameter resource_limit;
2.使用create profile创建一个定义对数据库资源进行限制的profile。SQL>create profile test limitidle_time 10 --分钟connect_time unlimited; --分钟3.使用create user 或alter user命令把profile分配给用户。SQL> create user qq identified by qq profiletest; --创建用户时指定profileUser created.SQL> alter user qq profile test; --修改用户的profileUser altered.SQL>SQL> alter user dinya profile default; --还原默认值
4.修改PROFILESQL> alter profile test limit idle_time 60;Profile altered.
5.删除PROFILESQL> drop profile test;SQL> drop profile test cascade;注意:1.已分配的profile,删除时必须加cascade选项。2.必须要有create profile 权限,才能创建profile。3.DEFAULT为默认profile,不能删除。6.信息获取  可以从dba_profiles表和dba_users表查询profile的信息,如:SQL> select profile from dba_users where username='TEST';SQL> select * from dba_profiles where profile='TEST';三. Profile 创建语法及解释3.1 语法 CREATE PROFILE profile
LIMIT { resource_parameters
|password_parameters
}
[ resource_parameters
| password_parameters
]... ;


{ { SESSIONS_PER_USER
| CPU_PER_SESSION
| CPU_PER_CALL
| CONNECT_TIME
| IDLE_TIME
| LOGICAL_READS_PER_SESSION
| LOGICAL_READS_PER_CALL
| COMPOSITE_LIMIT
}
{ integer | UNLIMITED | DEFAULT }
| PRIVATE_SGA
{ integer [ K | M ] | UNLIMITED | DEFAULT }
}
< password_parameters >
{ { FAILED_LOGIN_ATTEMPTS
| PASSWORD_LIFE_TIME
| PASSWORD_REUSE_TIME
| PASSWORD_REUSE_MAX
| PASSWORD_LOCK_TIME
| PASSWORD_GRACE_TIME
}
{ expr | UNLIMITED | DEFAULT }
| PASSWORD_VERIFY_FUNCTION
{ function | NULL | DEFAULT }
3.2 语法解释 profile:配置文件的名称。Oracle数据库以以下方式强迫资源限制:1.如果用户超过了connect_time或idle_time的会话资源限制,数据库就回滚当前事务,并结束会话。用户再次执行命令,数据库则返回一个错误。2.如果用户试图执行超过其他的会话资源限制的操作,数据库放弃操作,回滚当前事务并立即返回错误。用户之后可以提交或回滚当前事务,必须结束会话。 提示:可以将一条分成多个段,如1小时(1/24天)来限制时间,可以为用户指定资源限制,但是数据库只有在参数生效后才会执行限制。
Unlimited:分配该profile的用户对资源使用无限制,当使用密码参数时,unlimited意味着没有对参数加限制。 Default:指定为default意味着忽略对profile中的一些资源限制,Defaultprofile初始定义对资源不限制,可以通过alter profile命令来改变。
(1)Resource_parameter部分Session_per_user:指定限制用户的并发会话的数目。Cpu_per_session:指定会话的CPU时间限制,单位为百分之一秒。Cpu_per_call:指定一次调用(解析、执行和提取)的CPU时间限制,单位为百分之一秒。Connect_time:指定会话的总的连接时间,以分钟为单位。Idle_time:指定会话允许连续不活动的总的时间,以分钟为单位,超过该时间,会话将断开。但是长时间运行查询和其他操作的不受此限制。Logical_reads_per_session:指定一个会话允许读的数据块的数目,包括从内存和磁盘读的所有数据块。Logical_read_per_call:指定一次执行SQL(解析、执行和提取)调用所允许读的数据块的最大数目。Private_sga:指定一个会话可以在共享池(SGA)中所允许分配的最大空间,以字节为单位。(该限制只在使用共享服务器结构时才有效,会话在SGA中的私有空间包括私有的SQL和PL/SQL,但不包括共享的SQL和PL/SQL)。Composite_limit:指定一个会话的总的资源消耗,以service units单位表示。Oracle数据库以有利的方式计算cpu_per_session,connect_time,logical_reads_per_session和private-sga总的serviceunits。
(2) Password_parameter部分:Failed_login_attempts:指定在帐户被锁定之前所允许尝试登陆的的最大次数。Password_life_time:指定同一密码所允许使用的天数。如果同时指定了password_grace_time参数,如果在grace period内没有改变密码,则密码会失效,连接数据库被拒绝。如果没有设置password_grace_time参数,默认值unlimited将引发一个数据库警告,但是允许用户继续连接。Password_reuse_time和password_reuse_max:这两个参数必须互相关联设置,password_reuse_time指定了密码不能重用前的天数,而password_reuse_max则指定了当前密码被重用之前密码改变的次数。两个参数都必须被设置为整数。1).如果为这两个参数指定了整数,则用户不能重用密码直到密码被改变了password_reuse_max指定的次数以后在password_reuse_time指定的时间内。如:password_reuse_time=30,password_reuse_max=10,用户可以在30天以后重用该密码,要求密码必须被改变超过10次。2).如果指定了其中的一个为整数,而另一个为unlimited,则用户永远不能重用一个密码。3).如果指定了其中的一个为default,Oracle数据库使用定义在profile中的默认值,默认情况下,所有的参数在profile中都被设置为unlimited,如果没有改变profile默认值,数据库对该值总是默认为unlimited。4).如果两个参数都设置为unlimited,则数据库忽略他们。Password_lock_time:指定登陆尝试失败次数到达后帐户的缩定时间,以天为单位。Password_grace_time:指定宽限天数,数据库发出警告到登陆失效前的天数。如果数据库密码在这中间没有被修改,则过期会失效。Password_verify_function:该字段允许将复杂的PL/SQL密码验证脚本做为参数传递到createprofile语句。Oracle数据库提供了一个默认的脚本,但是自己可以创建自己的验证规则或使用第三方软件验证。对Function名称,指定的是密码验证规则的名称,指定为Null则意味着不使用密码验证功能。如果为密码参数指定表达式,则该表达式可以是任意格式,除了数据库标量子查询。
四、问题及解决办法4.1、一些错误信息及解决方法 一些错误信息及解决方法
ORA-02390 exceeded COMPOSITE_LIMIT, you arebeing logged off
Cause: The COMPOSITE_LIMIT for the profile isexceeded. That is, the weighted sum of the connection time, logical reads persession, CPU usage per session, and private SGA space used during the sessionexceeded the limit set by the COMPOSITE_LIMIT clause set in the user profile.
Action: If this happens often, ask the databaseadministrator to raise the COMPOSITE_LIMIT of the user profile, or determinewhich resource is used the most and raise the limit on that resource.

ORA-02391 exceeded simultaneousSESSIONS_PER_USER limit
Cause: An attempt was made to exceed the maximumnumber of concurrent sessions allowed by the SESSIONS_PER_USER clause of theuser profile.
Action: End one or more concurrent sessions orask the database administrator to increase the SESSIONS_PER_USER limit of theuser profile. For more information about SESSIONS_PER_USER and the databaseadministrator's specific tasks of adjusting concurrent sessions, see theOracle9i SQL Reference and the Oracle9i Database Administrator's Guide.

ORA-02392 exceeded session limit on CPU usage,you are being logged off
Cause: An attempt was made to exceed the maximumCPU usage allowed by the CPU_PER_SESSION clause of the user profile.
Action: If this happens often, ask the databaseadministrator to increase the CPU_PER_SESSION limit of the user profile.

ORA-02393 exceeded call limit on CPU usage
Cause: An attempt was made to exceed the maximumCPU time for a call, a parse, execute, or fetch, allowed by the CPU_PER_CALLclause of the user profile.
Action: If this happens often, ask the databaseadministrator to increase the CPU_PER_CALL limit of the user profile.

ORA-02394 exceeded session limit on IO usage,you are being logged off
Cause: An attempt was made to exceed the maximumI/O allowed by the LOGICAL_READS_PER_SESSION clause of the user profile.
Action: If this happens often, ask the databaseadministrator to increase the LOGICAL_READS_PER_SESSION limit of the userprofile.

ORA-02395 exceeded call limit on IO usage
Cause: An attempt was made to exceed the maximumI/O for a call, a parse, execute, or fetch, allowed by theLOGICAL_READS_PER_CALL clause of the user profile.
Action: If this happens often, ask the databaseadministrator to increase the LOGICAL_READS_PER_CALL limit of the user profile.

ORA-02396 exceeded maximum idle time, pleaseconnect again
Cause: A user has exceeded the maximum timeallowed to remain idle.
Action: The user must reconnect to the database.

ORA-02397 exceeded PRIVATE_SGA limit, you arebeing logged off
Cause: This error occurs only when using amulti-threaded server.
Action: Contact the database administrator toexpand the PRIVATE_SGA limit.

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】