際際滷

際際滷Share 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, its 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 arent at are wide-open to abuse by passing disgruntled employees.

Its 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. Thats governed
by a particular attribute of a resource profile, called SESSIONS_PER_USER.

Every User has a profile already, even if youve 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, youll 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, hell 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. Thats 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, youll 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

Similar to Userlimit (20)

PPTX
Unit4 NMA working with user accounts WINDOWS SERVER 2008
Sangeetha Rangarajan
PDF
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
Dave Stokes
PDF
Access Control Facilities in Oracle Database 11g r2
Amin Saqi
PPTX
Security and Integrity violations, Authorisation and views, Integrity Constant
Prakash Kumar
PDF
Database Concepts 7th Edition Kroenke Solutions Manual
herckbalz
PDF
Sever-based Password Synchronization: Managing Multiple Passwords
PortalGuard
PDF
Database Concepts 7th Edition Kroenke Solutions Manual
senraelmik53
PDF
Data base Access Control a look at Fine grain Access method
International Journal of Engineering Inventions www.ijeijournal.com
PDF
Solution Manual for Concepts of Database Management, 8th Edition
femonaves
PDF
Database Concepts 6th Edition Kroenke Solutions Manual
hajricamzmiz
DOCX
Queues, Pools and Caches - Paper
Gwen (Chen) Shapira
DOC
Allowing or preventing domain users from joining workstations to the domain
laonap166
PPT
Ch10 system administration
Raja Waseem Akhtar
PDF
Queues, Pools and Caches paper
Gwen (Chen) Shapira
PDF
Database Concepts 6th Edition Kroenke Solutions Manual
herckbalz
PDF
Don't be tardy configure password expiration with open sso and identity mana...
Jose R
DOCX
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
AmanGunner
PDF
Implementing role based access control on Web Application (sample case)
Deny Prasetia
PDF
Chapter 6 Database Security and Authorization (4).pdf
abrehamcheru14
Unit4 NMA working with user accounts WINDOWS SERVER 2008
Sangeetha Rangarajan
Southeast Linuxfest -- MySQL User Admin Tips & Tricks
Dave Stokes
Access Control Facilities in Oracle Database 11g r2
Amin Saqi
Security and Integrity violations, Authorisation and views, Integrity Constant
Prakash Kumar
Database Concepts 7th Edition Kroenke Solutions Manual
herckbalz
Sever-based Password Synchronization: Managing Multiple Passwords
PortalGuard
Database Concepts 7th Edition Kroenke Solutions Manual
senraelmik53
Data base Access Control a look at Fine grain Access method
International Journal of Engineering Inventions www.ijeijournal.com
Solution Manual for Concepts of Database Management, 8th Edition
femonaves
Database Concepts 6th Edition Kroenke Solutions Manual
hajricamzmiz
Queues, Pools and Caches - Paper
Gwen (Chen) Shapira
Allowing or preventing domain users from joining workstations to the domain
laonap166
Ch10 system administration
Raja Waseem Akhtar
Queues, Pools and Caches paper
Gwen (Chen) Shapira
Database Concepts 6th Edition Kroenke Solutions Manual
herckbalz
Don't be tardy configure password expiration with open sso and identity mana...
Jose R
ICT-DBA4-09-0811-Monitor-and-Administer-Database.docx
AmanGunner
Implementing role based access control on Web Application (sample case)
Deny Prasetia
Chapter 6 Database Security and Authorization (4).pdf
abrehamcheru14

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
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
PDF
Migration
oracle documents
Applyinga blockcentricapproachtotuning
oracle documents
Windowsosauthent
oracle documents
Whatistnsnames
oracle documents
Whatisadatabaselink
oracle documents
Varraysandnestedtables
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
Redosize
oracle documents
Real liferecoverypresentation
oracle documents
Real liferecoverypaper
oracle documents
Perfstats
oracle documents
Oracledates
oracle documents
Ora12154
oracle documents
Nologging
oracle documents
Migration
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, its 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 arent at are wide-open to abuse by passing disgruntled employees. Its 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. Thats governed by a particular attribute of a resource profile, called SESSIONS_PER_USER. Every User has a profile already, even if youve 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, youll 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, hell 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. Thats 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, youll 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