profile 配置文件(profile文件)

oracle配置文件(profile文件)

配置文件

create profile 配置文件名 limit

配置参数1

配置参数2

……;

查看用户的proifle是哪个,一般是default:

SELECT username,PROFILE FROM dba_users;


启动参数resource_limit设置后只对profile文件中的资源部分生效口令管理部分不依赖于这个参数.

口令管理

2.1 failed_login_attempts

failed_login_attempts指定在帐户被锁定之前所允许尝试登陆的的最大次数。

SQL> select * from dba_profiles where profile='DEFAULT' and resource_name='FAILED_LOGIN_ATTEMPTS';

PROFILE    RESOURCE_NAME                    RESOURCE LIMIT

---------- -------------------------------- -------- ----------

DEFAULT    FAILED_LOGIN_ATTEMPTS            PASSWORD 10

// 改成不受限

SQL> alter profile default limit failed_login_attempts unlimited;

Profile altered.

// 改成受限3

SQL> alter profile default limit failed_login_attempts 3;

Profile altered.

SQL> select * from dba_profiles where profile='DEFAULT' and resource_name='FAILED_LOGIN_ATTEMPTS';

PROFILE    RESOURCE_NAME                    RESOURCE LIMIT

---------- -------------------------------- -------- ----------

DEFAULT    FAILED_LOGIN_ATTEMPTS            PASSWORD 3

 

// 登录系统密码错误3次后再登录就会提示用户已锁定.

[oracle@cent4 ~]$ sqlplus hr/hr

SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 6 6 16:00:26 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:

ORA-28000: the account is locked

SQL> select a.username, a.account_status, a.lock_date from dba_users a where a.username = 'HR';

USERNAME   ACCOUNT_STATUS                   LOCK_DATE

---------- -------------------------------- -------------------

HR         LOCKED(TIMED)                    2011-06-06 16:00:23

 

// 解除用户锁定

SQL> alter user hr account unlock;

User altered.

SQL> select a.username, a.account_status, a.lock_date from dba_users a where a.username = 'HR';

USERNAME   ACCOUNT_STATUS                    LOCK_DATE

---------- -------------------------------- -------------------

HR         OPEN

2.2 password_lock_time

password_lock_time指定帐户被锁定的天数. 1/24/60对应的是1分钟但是, 1分钟后只有密码正确了才可以自动解锁. 如果该参数最后的值是UNLIMITED, 或需要立即给帐户解锁就需要DBA用手动方式来给帐户解锁.

SQL> select a.username, a.account_status, a.lock_date from dba_users a where a.username = 'HR';

USERNAME   ACCOUNT_STATUS                   LOCK_DATE

---------- -------------------------------- -------------------

HR         LOCKED(TIMED)                    2011-06-06 16:13:07

SQL> alter profile default limit password_lock_time 1/24/60;

Profile altered.

SQL> conn hr/hr

Connected.

SQL> conn sys/sys as sysdba

Connected.

SQL> select a.username, a.account_status, a.lock_date from dba_users a where a.username = 'HR';

USERNAME   ACCOUNT_STATUS                    LOCK_DATE

---------- -------------------------------- -------------------

HR         OPEN

2.3 password_life_timepassword_grace_time

password_life_time指定用户帐户的有效期达到这个天数的帐户叫做到期帐户到期帐户在登陆时会被提示口令将在多少天过期,但仍可以使用该口令最多宽限的天数由password_grace_time参数指定如果在宽限期中没有更改帐户的口令则帐户过期即叫过期帐户如果不更改到期帐户的口令就不能登陆数据库.

{1}                  {2}     {3}      到期          {4}      过期     

----------------------------------------------------------------------

|---à life_time ß---|       |---à grace_time ß---|

{1} 创建用户或修改配置文件的时间

{2} life_time的结束时间

{3} life_time的结束时间后用户第一次的登陆时间此后用户称为到期帐户用户状态由open变成了expire(grace), 但此时用户仍可以登陆系统.

{4} grace_time的结束时间此后用户称为过期帐户用户状态由expire(grace)变成了expire, 但此时用户登陆系统时要求要改新的密码改完密码后用户状态由expire变成了open.

 

l   初始状态

SQL> create user u1 identified by u1;

User created.

SQL> col username format a10;

SQL> col account_status format a15;

SQL> select username, account_status, lock_date, expiry_date from dba_users a where a.username = 'U1';

USERNAME   ACCOUNT_STATUS  LOCK_DATE           EXPIRY_DATE

---------- --------------- ------------------- -------------------

U1         OPEN

l   修改配置文件的password_life_time的值后(或者password_life_time的值不为unlimited, 创建用户后), 用户属性中的EXPIRY_DATE字段将有值生成

SQL> set time on;

19:38:42 SQL> alter profile default limit password_grace_time 10 password_life_time 3;

Profile altered.

19:38:48 SQL> select username, account_status, lock_date, expiry_date from dba_users a where a.username = 'U1';

USERNAME   ACCOUNT_STATUS  LOCK_DATE           EXPIRY_DATE

---------- --------------- ------------------- -------------------

U1         OPEN                                2011-06-10 19:38:42

注意: expiry_date = alter profile语句的调用的时间(19:38:42) + password_life_time(3)

 

l   将系统时间调到expiry_date之后发现用户的状态并不会发生变化仍然是open.

[root@cent4 ~]# date '06111200'

  6 11 12:00:00 CST 2011

[oracle@cent4 ~]$ sqlplus / as sysdba

SQL> col username format a10;

SQL> col account_status format a15;

SQL> select username, account_status, lock_date, expiry_date from dba_users a where a.username = 'U1';

USERNAME   ACCOUNT_STATUS  LOCK_DATE           EXPIRY_DATE

---------- --------------- ------------------- -------------------

U1         OPEN                                2011-06-10 19:38:42

 

l   将系统时间调到expiry_date之后用户登陆后该时间点才是password_grace_time的起始时间.

[root@cent4 ~]# date '06201200'

  6 20 12:00:00 CST 2011

[oracle@cent4 ~]$ sqlplus u1/u1

SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 6 20 12:00:23 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:

ORA-28002: the password will expire within 10 days

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL>

 

[oracle@cent4 ~]$ sqlplus / as sysdba

SQL> select username, account_status, lock_date, expiry_date from dba_users a where a.username = 'U1';

USERNAME   ACCOUNT_STATUS  LOCK_DATE           EXPIRY_DATE

---------- --------------- ------------------- -------------------

U1         EXPIRED(GRACE)                      2011-06-30 12:00:23

注意: 此时的expiry_date = 上面expiry_date的时间后第一次运行sqlplus u1/u1语句调用的时候(6 20 12:00:23 2011) + password_grace_time(10)

 

l   将系统时间调到password_grace_time之后用户要求输入新密码此时用户状态为expire; 输入密码后用户状态为open;

[oracle@cent4 ~]$ sqlplus u1/u1

SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 7 6 12:03:56 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

ERROR:

ORA-28001: the password has expired

Changing password for u1

New password: **

Retype new password: **

Password changed

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL>

 

// 输密码前

SQL> select username, account_status, lock_date, expiry_date from dba_users a where a.username = 'U1';

USERNAME   ACCOUNT_STATUS  LOCK_DATE           EXPIRY_DATE

---------- --------------- ------------------- -------------------

U1         EXPIRED                             2011-06-30 12:00:23

12:02:07 SQL> host date

  7  6 12:02:16 CST 2011

 

// 输密码后

SQL> select username, account_status, lock_date, expiry_date from dba_users a where a.username = 'U1';

USERNAME   ACCOUNT_STATUS  LOCK_DATE           EXPIRY_DATE

---------- --------------- ------------------- -------------------

U1         OPEN                                2011-07-09 12:04:02

2.4 password_reuse_timepassword_reuse_max

使用这两个参数后, ORACLE会将各个用户的历史记录存放到SYS用户的USER_HISTORY$表中.

SQL> alter profile default limit password_reuse_time 30 password_reuse_max 10;

Profile altered.

l   第一次登陆

[oracle@cent4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 6 7 11:40:46 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> alter user hr identified by hr1;

User altered.

SQL> alter user hr identified by hr2;

User altered.

l   第二次登陆

[oracle@cent4 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 6 7 12:06:40 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> alter user hr identified by hr1;

ORA-28007: the password cannot be reused

 

2.5 password_verify_function

使用系统口令校验函数verify_function, 改成校验函数后实现以下口令规则:

口令不能少于4个字符

口令不能与用户名相同

口令至少包含一个字符一个数字和一个特殊字符($, _, #, !)

要使用校验函数verify_function, 必须运行脚本 @$ORACLE_HOME/rdbms/admin/utlpwdmg.sql

 

SQL> alter user hr identified by hr40;

ORA-28003: password verification for the specified password failed

ORA-20003: Password should contain at least one digit, one character and one punctuation


资源限制参数管理

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中的私有空间包括私有的sqlpl/sql但不包括共享的sqlpl/sql)

composite_limit

指定一个会话的总的资源消耗service units单位表示。oracle数据库以有利的方式计算cpu_per_session, connect_time, logical_reads_per_sessionprivate-sga总的service units


4 口令管理参数管理

FAILED_LOGIN_ATTEMPTS: 限制用户在登录Oracle数据库时允许失败的 次数,如果超过,则锁定。
PASSWORD_LOCK_TIME:    设定当前用户登陆失败后,用户账户被锁定 时间长度。
PASSWORD_LIFE_TIME:    设置用户口令有效天数,达到限制天数后,口令过期。
PASSWORD_GRACE_TIME:   用于设定提示口令过期天数,再此期间,登陆会提醒还剩多少天过期。
PASSWORD_REUSE_TIME:   指定一个用户口令被修改后,必须经过多少天以后才可重新使用该口令。
PASSWORD_REUSE_MAX:    指定一个口令被重新使用前,必须经过多少次修改。
PASSWORD_VERIFY_FUNCTION: 设置口令复杂性校验函授,对口令复杂度设置。


eg: create profile profile_name limit
    [session_per_user  integer|unlimited|default]
    [ cpu_per_session   .........................]
    [  cpu_per_call  
    [ connect_time   ......
    资源参数,口令参数 都写入。。。。




dba_users
dba_profiles
user_password_limits
user_resource_limits
resource_cost


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值