oracle限制一个用户空闲时间

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即可

猜你喜欢

转载自www.cnblogs.com/fanweisheng/p/11113428.html
今日推荐