Oracle limits the number of connections of an IP address

Source: Internet
Author: User


Oracle limits the number of connections of an IP address in database management. It may limit the number of connections from an IP address to the database or the number of connections from a user to the database. To limit the number of connections to the database, we can start with the profile of the database and use the profile feature to meet this requirement. Www.2cto.com can use the logon database trigger to limit the number of connections to the IP address to access the database. Each new session login records the IP in the client_info of vrsession, and then count the number of all qualified sessions. If the number of qualified sessions exceeds, the session is disconnected directly. However, if this session is restricted to database connection, it can only take effect for non-dba users. Dba users only write a warning message in alert. log. The trigger code for implementing this function at www.2cto.com is as follows: SQL code create or replace trigger logon_audit after logon on database declare /*************************** **************************************** * ************** NAME: logon_audit PURPOSE: restrict the number of connections from an IP address to a database instance. If the limit is exceeded, an error occurs or an alarm is reported. NOTES: 1. Use sys to submit data to the database 2. Use the logon database trigger to implement www.2cto.com ************************ **************************************** * ****************** // according to the plan, define three types of variable names: number, string, date */I _sessions number; I _sessions_limited number: = 30; str_userip varchar2 (15): = '192. 168.15.148 '; t_t_ip_limited exception; begin dbms_application_info.set_client_info (sys_context ('userenv', 'IP _ address' ); Select count (*) into I _sessions from v $ session where client_info = str_userip; if (I _sessions> I _sessions_limited) then raise effect_ip_limited; end if; exception when effect_ip_limited then raise_application_error (-20003, 'IP: '| str_userip |' the number of connections is limited! '); End logon_audit; Source http://mikixiyou.iteye.com/blog/1705838

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.