alter system set resource_limit = true;
create profile idletime limit idle_time 3;
alter user outln profile idletime;
SQL> alter system set resource_limit = true;
系統已更改。
SQL> conn sys/sunsdl as sysdba
已連接。
SQL> create profile idletime limit idle_time 1;
配置文件已創建
SQL> alter user outln profile idletime;
用戶已更改
SQL> conn outln/outln
已連接。
SQL>
SQL> set time on
15:14:26 SQL> ... 等待1分多鍾
15:17:51 SQL> select sysdate from dual;
select sysdate from dual
*
ERROR 位於第 1 行:
ORA-02396: 超出最大空閑時間,請重新連接
程序中沒有關閉打開的數據連接。而且重復打開連接。inactive說明當前沒有操作,不表示當前無連接。
我們知道,在Oracle數據庫中,可以通過kill session的方式來終止一個進程,其基本語法結構為:
alter system kill session 'sid,serial#';
inactive session是正常的,每個session不可能都是active呀
只是那些已異常退出的、但沒有disconnect客戶端,需要啟動DCD,將其清除,往sqlnet.ora文件中添加sqlnet.timeout=xMin,重啟listener即可