今天在项目开发中,发现数据库连接数过多,oracle中存在很多超时连接。导致新增客户端无法连接到数据库。所以设置了强制释放oracle连接属性。
在网上查询了设置说明如下:
sqlplus /nolog
打开sqlplus
connect system/bianqiwei@orcltns as sysdba
使用具有dba权限得用户登陆oracle
show parameter resource_limit
显示资源限定是否开启,value为true是开启,为false是关闭
alter system set resource_limit=true
如果未开启,则使用此命令开启资源限定功能
create profile profileName limit connect_time 60 idle_time 30
创建profile文件,profileName任意起,connect_time设置连接超过多少分钟后强制释放,idle_time设置连续不活动的会话超过多少分钟后强制释放
alter user oracleUser profile profileName
将profile文件作用于指定用户
在数据库中的实际操作如下:
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@nsn-db-server ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 16:14:11 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> show parameter resource
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
resource_limit boolean
FALSE
resource_manager_plan string
SQL> alter system set resource_limit=true;
System altered.
SQL> create profile sbaplimit20091222 limit connect_time 60 idle_time 30
2
SQL> create profile sbaplimit20091222 limit connect_time 60 idle_time 30
2
SQL>
SQL> create profile sbaplimit20091222 limit connect_time 60 idle_time 30;
Profile created.
SQL> alter user sbap profile sbaplimit20091222_;
User altered.
SQL> exit