建立一個容許3分鐘IDLE時間的PROFILE:sql
SQL> CREATE PROFILE KILLIDLE LIMIT IDLE_TIME 3; Profile created.
新建立PROFILE的內容:服務器
SQL> col limit for a10 SQL> select * from dba_profiles where profile='KILLIDLE'; PROFILE RESOURCE_NAME RESOURCE LIMIT —————————— ——————————– ——– ———- KILLIDLE COMPOSITE_LIMIT KERNEL DEFAULT KILLIDLE SESSIONS_PER_USER KERNEL DEFAULT KILLIDLE CPU_PER_SESSION KERNEL DEFAULT KILLIDLE CPU_PER_CALL KERNEL DEFAULT KILLIDLE LOGICAL_READS_PER_SESSION KERNEL DEFAULT KILLIDLE LOGICAL_READS_PER_CALL KERNEL DEFAULT KILLIDLE IDLE_TIME KERNEL 3 KILLIDLE CONNECT_TIME KERNEL DEFAULT KILLIDLE PRIVATE_SGA KERNEL DEFAULT KILLIDLE FAILED_LOGIN_ATTEMPTS PASSWORD DEFAULT KILLIDLE PASSWORD_LIFE_TIME PASSWORD DEFAULT PROFILE RESOURCE_NAME RESOURCE LIMIT —————————— ——————————– ——– ———- KILLIDLE PASSWORD_REUSE_TIME PASSWORD DEFAULT KILLIDLE PASSWORD_REUSE_MAX PASSWORD DEFAULT KILLIDLE PASSWORD_VERIFY_FUNCTION PASSWORD DEFAULT KILLIDLE PASSWORD_LOCK_TIME PASSWORD DEFAULT KILLIDLE PASSWORD_GRACE_TIME PASSWORD DEFAULT 16 rows selected.
測試用戶:oracle
SQL> select username,profile from dba_users where username='EYGLE'; USERNAME PROFILE —————————— ——————– EYGLE DEFAULT
修改eygle用戶的PROFILE使用新建的PROFILE:測試
SQL> alter user eygle profile killidle; User altered. SQL> select username,profile from dba_users where username='EYGLE'; USERNAME PROFILE —————————— ——————– EYGLE KILLIDLE
進行鏈接測試:spa
[oracle@test126 admin]$ sqlplus eygle/eygle@eygle SQL*Plus: Release 10.2.0.1.0 - Production on Fri Oct 13 08:07:13 2006 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 and Data Mining options SQL> select username,profile from dba_users where username='EYGLE'; USERNAME PROFILE —————————— —————————— EYGLE KILLIDLE
當IDLE超過限制時間時,鏈接會被斷開:code
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual; TO_CHAR(SYSDATE,’YY ——————- 2006-10-13 08:08:41 SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual; select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual * ERROR at line 1: ORA-02396: exceeded maximum idle time, please connect again