Well in my opinion, if you need what is obviously too many threads, then there is a coding issue.
So to make people think twice before flooding a service with connections I've started limiting the number of sessions they are allowed to have.
Easy as always to do in Oracle. First we allow resource limits by setting the resource_limit to true, then we simply create a profile and assign that to the user. The profile can set the limit of how many session a user is allowed to have.
A little demonstration;
oracle@htpc:~$ rsqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 30 21:56:12 2007
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_limit
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
resource_limit boolean FALSE
SQL> alter system set RESOURCE_LIMIT=true scope=both;
System altered.
SQL> create profile sesslimit limit sessions_per_user 2;
Profile created.
SQL> create user fish identified by fish123
2 default tablespace data profile sesslimit;
User created.
SQL> grant create session to fish;
Grant succeeded.
SQL> connect fish/fish123
Connected.
SQL> disconnect
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
-- I'll start two sessions in another terminal.
SQL> connect fish/fish123
ERROR:
ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit
SQL>
2 comments:
hi sir,
can you please tell me what is the maximum number of sessions allowed in oracle 10g database.
Good post.
Post a Comment