SlideShare a Scribd company logo
Limiting concurrent connections                                                 Administration Tips




Limiting concurrent connections by Users

Having Users make multiple connections to a database is a problem for a variety of reasons.
Firstly, it chews up resources. Each connection acquires (in dedicated server mode, at
least) a Server Process and a PGA –which means each connection starts using up memory
and CPU cycles, even if the session itself is sitting their doing nothing very strenuous.
Secondly, it’s a potential security issue: if a User is logged on 6 times, it is unlikely that
they can be physically present at all 6 workstations simultaneously, which means the ones
they aren’t at are wide-open to abuse by passing disgruntled employees.

It’s therefore a very good idea to limit the maximum number of concurrent connections a
User is permitted to make to a database, and the tool used to do that is the Resource
Profile, which has been around since at least Oracle 7.

A resource profile allows the DBA to limit a number of things that a User can do –for
example, a maximum connection time can be specified (e.g., 480 minutes, or 8 hours), or
a maximum idle time. But for our purposes, we can concentrate on the ability to limit the
number of sessions a User is permitted to have running at any one time. That’s governed
by a particular attribute of a resource profile, called SESSIONS_PER_USER.

Every User has a profile already, even if you’ve never been aware of it, or made use of the
fact. That profile is called ‘DEFAULT’, and is the one all Users acquire (by default!) when
first created, unless you specify another named profile.

A quick solution to the concurrent connections problem would thus involve simply editing
the DEFAULT profile, like this:

ALTER PROFILE DEFAULT
SESSIONS_PER_USER 2;

… and that would then prevent all Users from ever acquiring more than 2 concurrent
sessions (although it will only take effect when they start re-connecting to the database).
Note that there is no equals sign between the attribute name and its setting.

A more subtle approach would be to allow some Users to make 3 connections, others to
create 5. For that sort of discrimination, you’ll need to create your own profiles, like this:

CREATE PROFILE BLAH3              LIMIT
SESSIONS_PER_USER 3;

CREATE PROFILE BLAH5              LIMIT
SESSIONS_PER_USER 5;

You then have to assign the right profile to the right user, like this:

Copyright © Howard Rogers 2001             10/18/2001                                    Page 1 of 2
Limiting concurrent connections                                                       Administration Tips




ALTER    USER FRED PROFILE BLAH3;
ALTER    USER MARY PROFILE BLAH5;


… and so on.

Next time Fred tries to log on multiple times, he’ll get the following error message on his
fourth attempt:

ERROR:ORA-02391:                  EXCEEDED SIMULTANEOUS   SESSIONS_PER_USER   LIMIT


There is one extremely important point to know about resource profiles, however: they
take no effect whatsoever until you switch them on. That is, even though they have been
created, and properly assigned to all Users, no-one will have any connection limits until
you tell the database to actually start enforcing the limits. That’s done with the following
command:

ALTER    SYSTEM SET RESOURCE_LIMIT=TRUE;


That switches on profile limits for the duration of the Instance, and for new connections
only. A more permanent fix is to edit your init.ora, and enter the line
resource_limit=true there. That way, every time you bounce the Instance, you’ll find
resource profile limit being enforced.

(Incidentally, any sessions a User already has running when you assign him the new profile
and switch resource limiting on with the ‘alter system’ command are counted against his
allowed total. So if a User already has 4 connections when you suddenly start limiting him
to just 3, he will immediately not be able to make a fifth connection. However, the
original 4 are not disconnected, and are allowed to proceed as normal).




Copyright © Howard Rogers 2001                      10/18/2001                                 Page 2 of 2

More Related Content

PDF
Rollbackshrinks
oracle documents
 
PDF
Tablerename
oracle documents
 
PDF
Rollbackblocking
oracle documents
 
PDF
Rollbacksizes
oracle documents
 
PDF
Sequencereset
oracle documents
 
PDF
Undo internalspresentation
oracle documents
 
PDF
Usertracing
oracle documents
 
PDF
Ppleman
yoyun
 
Rollbackshrinks
oracle documents
 
Tablerename
oracle documents
 
Rollbackblocking
oracle documents
 
Rollbacksizes
oracle documents
 
Sequencereset
oracle documents
 
Undo internalspresentation
oracle documents
 
Usertracing
oracle documents
 
Ppleman
yoyun
 

Similar to Userlimit (20)

PDF
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
ZendCon
 
PDF
MariaDB/MySQL_: Developing Scalable Applications
Federico Razzoli
 
PDF
Oracle RDBMS architecture
Martin Berger
 
PPTX
Some Oracle AWR observations
Connor McDonald
 
PDF
Queues, Pools and Caches paper
Gwen (Chen) Shapira
 
DOCX
Queues, Pools and Caches - Paper
Gwen (Chen) Shapira
 
PPTX
RMOUG2016 - Resource Management (the critical piece of the consolidation puzzle)
Kristofferson A
 
PPT
Advance MySQL Docstore Features
sankalita chakraborty
 
DOCX
Manage Lists and Libraries with Many Items - EPC Group
EPC Group
 
PDF
Ebs dba con4696_pdf_4696_0001
jucaab
 
PPTX
Administration and Management of Users in Oracle / Oracle Database Storage st...
rajeshkumarcse2001
 
PDF
Tips and Tricks for SAP Sybase ASE
Don Brizendine
 
PDF
81 Pdfsam
Emanuel Mateus
 
PDF
81 Rac
Emanuel Mateus
 
PPTX
Databases 101
David Caughill
 
DOC
Fahad mahmood database administrator
fahad_dba
 
PDF
How To Control IO Usage using Resource Manager
Alireza Kamrani
 
PDF
153 Oracle dba interview questions
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
PPTX
Pros/Cons JDBC HIBERNATE EJB
Rajkumar Singh
 
PPTX
Oracle ebs capacity_analysisusingstatisticalmethods
Ajith Narayanan
 
Solving the C20K problem: Raising the bar in PHP Performance and Scalability
ZendCon
 
MariaDB/MySQL_: Developing Scalable Applications
Federico Razzoli
 
Oracle RDBMS architecture
Martin Berger
 
Some Oracle AWR observations
Connor McDonald
 
Queues, Pools and Caches paper
Gwen (Chen) Shapira
 
Queues, Pools and Caches - Paper
Gwen (Chen) Shapira
 
RMOUG2016 - Resource Management (the critical piece of the consolidation puzzle)
Kristofferson A
 
Advance MySQL Docstore Features
sankalita chakraborty
 
Manage Lists and Libraries with Many Items - EPC Group
EPC Group
 
Ebs dba con4696_pdf_4696_0001
jucaab
 
Administration and Management of Users in Oracle / Oracle Database Storage st...
rajeshkumarcse2001
 
Tips and Tricks for SAP Sybase ASE
Don Brizendine
 
81 Pdfsam
Emanuel Mateus
 
Databases 101
David Caughill
 
Fahad mahmood database administrator
fahad_dba
 
How To Control IO Usage using Resource Manager
Alireza Kamrani
 
153 Oracle dba interview questions
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
Pros/Cons JDBC HIBERNATE EJB
Rajkumar Singh
 
Oracle ebs capacity_analysisusingstatisticalmethods
Ajith Narayanan
 
Ad

More from oracle documents (20)

PPT
Applyinga blockcentricapproachtotuning
oracle documents
 
PDF
Windowsosauthent
oracle documents
 
PDF
Whatistnsnames
oracle documents
 
PDF
Whatisadatabaselink
oracle documents
 
PDF
Varraysandnestedtables
oracle documents
 
PDF
Userpasswrd
oracle documents
 
PDF
Undo internals paper
oracle documents
 
PDF
Tablespacelmt
oracle documents
 
PDF
Sql scripting sorcerypresentation
oracle documents
 
PDF
Sql scripting sorcerypaper
oracle documents
 
PDF
Sql for dbaspresentation
oracle documents
 
PDF
Rollbacklmt
oracle documents
 
PDF
Rollback1555s
oracle documents
 
PDF
Redosize
oracle documents
 
PDF
Real liferecoverypresentation
oracle documents
 
PDF
Real liferecoverypaper
oracle documents
 
PDF
Perfstats
oracle documents
 
PDF
Oracledates
oracle documents
 
PDF
Ora12154
oracle documents
 
PDF
Nologging
oracle documents
 
Applyinga blockcentricapproachtotuning
oracle documents
 
Windowsosauthent
oracle documents
 
Whatistnsnames
oracle documents
 
Whatisadatabaselink
oracle documents
 
Varraysandnestedtables
oracle documents
 
Userpasswrd
oracle documents
 
Undo internals paper
oracle documents
 
Tablespacelmt
oracle documents
 
Sql scripting sorcerypresentation
oracle documents
 
Sql scripting sorcerypaper
oracle documents
 
Sql for dbaspresentation
oracle documents
 
Rollbacklmt
oracle documents
 
Rollback1555s
oracle documents
 
Real liferecoverypresentation
oracle documents
 
Real liferecoverypaper
oracle documents
 
Perfstats
oracle documents
 
Oracledates
oracle documents
 
Nologging
oracle documents
 
Ad

Userlimit

  • 1. Limiting concurrent connections Administration Tips Limiting concurrent connections by Users Having Users make multiple connections to a database is a problem for a variety of reasons. Firstly, it chews up resources. Each connection acquires (in dedicated server mode, at least) a Server Process and a PGA –which means each connection starts using up memory and CPU cycles, even if the session itself is sitting their doing nothing very strenuous. Secondly, it’s a potential security issue: if a User is logged on 6 times, it is unlikely that they can be physically present at all 6 workstations simultaneously, which means the ones they aren’t at are wide-open to abuse by passing disgruntled employees. It’s therefore a very good idea to limit the maximum number of concurrent connections a User is permitted to make to a database, and the tool used to do that is the Resource Profile, which has been around since at least Oracle 7. A resource profile allows the DBA to limit a number of things that a User can do –for example, a maximum connection time can be specified (e.g., 480 minutes, or 8 hours), or a maximum idle time. But for our purposes, we can concentrate on the ability to limit the number of sessions a User is permitted to have running at any one time. That’s governed by a particular attribute of a resource profile, called SESSIONS_PER_USER. Every User has a profile already, even if you’ve never been aware of it, or made use of the fact. That profile is called ‘DEFAULT’, and is the one all Users acquire (by default!) when first created, unless you specify another named profile. A quick solution to the concurrent connections problem would thus involve simply editing the DEFAULT profile, like this: ALTER PROFILE DEFAULT SESSIONS_PER_USER 2; … and that would then prevent all Users from ever acquiring more than 2 concurrent sessions (although it will only take effect when they start re-connecting to the database). Note that there is no equals sign between the attribute name and its setting. A more subtle approach would be to allow some Users to make 3 connections, others to create 5. For that sort of discrimination, you’ll need to create your own profiles, like this: CREATE PROFILE BLAH3 LIMIT SESSIONS_PER_USER 3; CREATE PROFILE BLAH5 LIMIT SESSIONS_PER_USER 5; You then have to assign the right profile to the right user, like this: Copyright © Howard Rogers 2001 10/18/2001 Page 1 of 2
  • 2. Limiting concurrent connections Administration Tips ALTER USER FRED PROFILE BLAH3; ALTER USER MARY PROFILE BLAH5; … and so on. Next time Fred tries to log on multiple times, he’ll get the following error message on his fourth attempt: ERROR:ORA-02391: EXCEEDED SIMULTANEOUS SESSIONS_PER_USER LIMIT There is one extremely important point to know about resource profiles, however: they take no effect whatsoever until you switch them on. That is, even though they have been created, and properly assigned to all Users, no-one will have any connection limits until you tell the database to actually start enforcing the limits. That’s done with the following command: ALTER SYSTEM SET RESOURCE_LIMIT=TRUE; That switches on profile limits for the duration of the Instance, and for new connections only. A more permanent fix is to edit your init.ora, and enter the line resource_limit=true there. That way, every time you bounce the Instance, you’ll find resource profile limit being enforced. (Incidentally, any sessions a User already has running when you assign him the new profile and switch resource limiting on with the ‘alter system’ command are counted against his allowed total. So if a User already has 4 connections when you suddenly start limiting him to just 3, he will immediately not be able to make a fifth connection. However, the original 4 are not disconnected, and are allowed to proceed as normal). Copyright © Howard Rogers 2001 10/18/2001 Page 2 of 2