Oracle服務器連接數過多會當掉
通過profile可以對用戶會話進行一定的限制
將IDLE超過一定時間的會話斷開
使用這些資源限制特性
[oracle@test
SQL*Plus: Release
Copyright (c)
Connected to:
Oracle Database
With the Partitioning and Data Mining options
SQL> show parameter resource
NAME TYPE VALUE
resource_limit boolean TRUE
resource_manager_plan string
該參數可以動態修改
SQL> alter system set resource_limit=true;
System altered
數據庫缺省的PROFILE設置為
SQL> SELECT * FROM DBA_PROFILES;
PROFILE RESOURCE_NAME RESOURCE LIMIT
DEFAULT COMPOSITE_LIMIT KERNEL UNLIMITED
DEFAULT SESSIONS_PER_USER KERNEL UNLIMITED
DEFAULT CPU_PER_SESSION KERNEL UNLIMITED
DEFAULT CPU_PER_CALL KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_SESSION KERNEL UNLIMITED
DEFAULT LOGICAL_READS_PER_CALL KERNEL UNLIMITED
DEFAULT IDLE_TIME KERNEL UNLIMITED
DEFAULT CONNECT_TIME KERNEL UNLIMITED
DEFAULT PRIVATE_SGA KERNEL UNLIMITED
DEFAULT FAILED_LOGIN_ATTEMPTS PASSWORD
DEFAULT PASSWORD_LIFE_TIME PASSWORD UNLIMITED
PROFILE RESOURCE_NAME RESOURCE LIMIT
DEFAULT PASSWORD_REUSE_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_REUSE_MAX PASSWORD UNLIMITED
DEFAULT PASSWORD_VERIFY_FUNCTION PASSWORD NULL
DEFAULT PASSWORD_LOCK_TIME PASSWORD UNLIMITED
DEFAULT PASSWORD_GRACE_TIME PASSWORD UNLIMITED
創建一個允許
SQL> CREATE PROFILE KILLIDLE LIMIT IDLE_TIME
Profile created
新創建PROFILE的內容
SQL> col limit for a
SQL> select * from dba_profiles where profile=
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
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
測試用戶
SQL> select username
USERNAME PROFILE
EYGLE DEFAULT
修改eygle用戶的PROFILE使用新建的PROFILE
SQL> alter user eygle profile killidle;
User altered
SQL> select username
USERNAME PROFILE
EYGLE KILLIDLE
進行連接測試
[oracle@test
SQL*Plus: Release
Copyright (c)
Connected to:
Oracle Database
With the Partitioning and Data Mining options
SQL> select username
USERNAME PROFILE
EYGLE KILLIDLE
當IDLE超過限制時間時
SQL> select to_char(sysdate
TO_CHAR(SYSDATE
SQL> select to_char(sysdate
select to_char(sysdate
*
ERROR at line
ORA
From:http://tw.wingwit.com/Article/program/Oracle/201311/17659.html