--数据库系统信息SQL> select * from v$version;BANNER--------------------------------------------------------------------------------Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionPL/SQL Release 11.2.0.4.0 - ProductionCORE 11.2.0.4.0ProductionTNS for Linux: Version 11.2.0.4.0 - ProductionNLSRTL Version 11.2.0.4.0 - ProductionSQL> select sysdate from dual;SYSDATE---------26-JUN-17--查看用户状态SQL> set linesize 100SQL> col username for a30SQL> alter user sean password expire;SQL> alter user sean account lock;SQL> select USERNAME,ACCOUNT_STATUS,LOCK_DATE,EXPIRY_DATE,PROFILE from dba_users where username in ('SEAN');USERNAME ACCOUNT_STATUS LOCK_DATE EXPIRY_DA PROFILE---------- -------------------- --------- --------- -------SEAN EXPIRED & LOCKED26-JUN-17 26-JUN-17 DEFAULT--解锁用户SQL> alter user sean account unlock;--重新设置密码SQL> alter user sean password unexpire;alter user sean password unexpire*ERROR at line 1:ORA-02000: missing EXPIRE keyword--报错,只能重置设置密码(可以和老密码相同)SQL> alter user sean identified by sean;SQL> select USERNAME,ACCOUNT_STATUS,LOCK_DATE,EXPIRY_DATE,PROFILE from dba_users where username in ('SEAN');USERNAME ACCOUNT_STATUS LOCK_DATE EXPIRY_DA PROFILE---------- -------------------- --------- --------- --------------------SEAN OPEN 23-DEC-17 DEFAULT--可以看到新设置的密码180天后失效,其实是用户sean对应的profile中的属性PASSWORD_LIFE_TIME值控制的SQL> select * from dba_profiles where profile='DEFAULT';PROFILE RESOURCE_NAMERESOURCE LIMIT-------------------- -------------------------------- -------- ----------------------------------------DEFAULT COMPOSITE_LIMIT KERNEL UNLIMITEDDEFAULT SESSIONS_PER_USERKERNEL UNLIMITEDDEFAULT CPU_PER_SESSION KERNEL UNLIMITEDDEFAULT CPU_PER_CALL KERNEL UNLIMITEDDEFAULT LOGICAL_READS_PER_SESSION KERNEL UNLIMITEDDEFAULT LOGICAL_READS_PER_CALL KERNEL UNLIMITEDDEFAULT IDLE_TIME KERNEL UNLIMITEDDEFAULT CONNECT_TIME KERNEL UNLIMITEDDEFAULT PRIVATE_SGA KERNEL UNLIMITEDDEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD 10DEFAULT PASSWORD_LIFE_TIMEPASSWORD 180DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITEDDEFAULT PASSWORD_REUSE_MAXPASSWORD UNLIMITEDDEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD NULLDEFAULT PASSWORD_LOCK_TIMEPASSWORD 1DEFAULT PASSWORD_GRACE_TIME PASSWORD 7--如果想设置用户密码永不过期,那么设置用户对应的profile的PASSWORD_LIFE_TIME为unlimitedSQL> alter profile default LIMIT PASSWORD_LIFE_TIME unlimited;SQL> select * from dba_profiles where profile='DEFAULT' and RESOURCE_NAME='PASSWORD_LIFE_TIME';PROFILE RESOURCE_NAMERESOURCE LIMIT-------------------- -------------------------------- -------- ----------------------------------------DEFAULT PASSWORD_LIFE_TIMEPASSWORD UNLIMITEDSQL> select USERNAME,ACCOUNT_STATUS,LOCK_DATE,EXPIRY_DATE,PROFILE from dba_users where username in ('SEAN');USERNAME ACCOUNT_STATUS LOCK_DATE EXPIRY_DA PROFILE---------- -------------------- --------- --------- --------------------SEAN OPEN DEFAULT--可以看到,用户密码失效日期为空
700字范文,内容丰富有趣,生活中的好帮手!