search
HomeDatabaseMysql Tutorial数据库管理Oracle 连接池信息的修改

数据库管理Oracle 连接池信息的修改

Jun 07, 2016 pm 04:19 PM
oracleinformationRevisedatabasemanageconnect

最近项目中用到的Oracle数据库在服务器上是建了多个表空间供不同系统使用,两个系统同时在使用过程中,正在开发的一个项目在测试运行时,时不时就出现连接池满了,连接不上的问题,为此查了下怎么修改Oracle连接池配置的修改方式,特记录下来备查。 目前Orac

       最近项目中用到的Oracle数据库在服务器上是建了多个表空间供不同系统使用,两个系统同时在使用过程中,正在开发的一个项目在测试运行时,时不时就出现连接池满了,连接不上的问题,为此查了下怎么修改Oracle连接池配置的修改方式,特记录下来备查。

  目前Oracle只支持一个连接池,pool name为“SYS_DEFAULT_CONNECTION_POOL”,管理连接池信息的也就一个包“DBMS_CONNECTION_POOL”。

  先看看包的相关说明:

  SQL> desc DBMS_CONNECTION_POOL

Element Type

---------------- ---------

ALTER_PARAM PROCEDURE

CONFIGURE_POOL PROCEDURE

RESTORE_DEFAULTS PROCEDURE

START_POOL PROCEDURE

STOP_POOL PROCEDURE

 

 

  包里面有5个存储过程。默认Oracle是包含一个缺省的连接池SYS_DEFAULT_CONNECTION_POOL,但是并没有被打开,需要显示的开启连接池,第一步当然就是开启连接池:

  exec DBMS_CONNECTION_POOL.START_POOL('SYS_DEFAULT_CONNECTION_POOL');

 

  这个操作只需要做一次,,下次数据库重启了之后连接池会自动开启的。

  打开了连接池之后可以通过系统视图dba_cpool_info进行查询:

  SQL> select connection_pool,status from dba_cpool_info;

CONNECTION_POOL STATUS-------------------------------------------------------------------------------- ----------------

SYS_DEFAULT_CONNECTION_POOL ACTIVE
 

 

  当连接池启动了之后,可以通过DBMS_CONNECTION_POOL.CONFIGURE_POOL来查看连接池的相关配置项。

  SQL> desc DBMS_CONNECTION_POOL.CONFIGURE_POOL

Parameter Type Mode Default?

---------------------- -------------- ---- --------

POOL_NAME VARCHAR2 IN Y

MINSIZE BINARY_INTEGER IN Y

MAXSIZE BINARY_INTEGER IN Y

INCRSIZE BINARY_INTEGER IN Y

SESSION_CACHED_CURSORS BINARY_INTEGER IN Y

INACTIVITY_TIMEOUT BINARY_INTEGER IN Y

MAX_THINK_TIME BINARY_INTEGER IN Y

MAX_USE_SESSION BINARY_INTEGER IN Y

MAX_LIFETIME_SESSION BINARY_INTEGER IN Y

 

 

  参数说明:

参数                         说明

MINSIZE        在pool中最小数量的pooled servers,缺省为4。
MAXSIZE       在pool中最大数量的pooled servers,缺省为40。
INCRSIZE     这个参数是在一个客户端应用需要连接的时候,当pooled servers不可用的状态时候,每次pool增加pooled servers的数目。
 

SESSION_CACHED_CURSORS     缓存在每个pooled servers上的会话游标的数目,缺省为20。
INACTIVITY_TIMEOUT         pooled server处于idle状态的最大时间,单位秒, 超过这个时间,the server将被停止。缺省为300.
 

MAX_THINK_TIME   在一个客户端从pool中获得一个pooled server之后,如 果在MAX_THINK_TIME时间之内没有提交数据库调用的话,这个pooled server将被释放,客户端连接将被停止。缺省为30,单位秒。

MAX_USE_SESSION             pooled server能够在pool上taken和释放的次数,缺省为5000。
MAX_LIFETIME_SESSION      The time, in seconds, to live for a pooled server in the pool. Thedefault value is 3600.一个pooled server在pool中的生命值。

  注:在pooled server数目不能低于MINSIZE。

  可以使用DBMS_CONNECTION_POOL.CONFIGURE_POOL或DBMS_CONNECTION_POOL.ALTER_PARAM对连接池的设置进行修改。

  先来看看参数信息:

  SQL> desc DBMS_CONNECTION_POOL.ALTER_PARAM

Parameter Type Mode Default?

----------- -------- ---- --------

POOL_NAME VARCHAR2 IN Y

PARAM_NAME VARCHAR2 IN

PARAM_VALUE VARCHAR2 IN

 

 

 

  SQL> exec DBMS_CONNECTION_POOL.ALTER_PARAM ('','minsize','10');

PL/SQL procedure successfully completed

SQL> exec DBMS_CONNECTION_POOL.ALTER_PARAM ('','maxsize','100');

PL/SQL procedure successfully completed

 

  由于只有一个连接池,第一个参数的值可以省略。

  系统中有几个系统视图比较有用:

  DBA_CPOOL_INFO 这个视图包含着连接池的状态

  V$CPOOL_STATS 这个视图包含着连接池的统计信息

  V$CPOOL_CC_STATS 这个视图包含着池的连接类型级别统计

  修改成功了之后可以查询下连接池信息:

  SQL> select CONNECTION_POOL, STATUS,MINSIZE,MAXSIZE from DBA_CPOOL_INFO;

CONNECTION_POOL STATUS MINSIZE MAXSIZE

-------------------------------------------------------------------------------- ---------------- ---------- ----------

SYS_DEFAULT_CONNECTION_POOL ACTIVE 10 100

 

 

  到此,连接池的设置和相关修改已经完成。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL BLOB : are there any limits?MySQL BLOB : are there any limits?May 08, 2025 am 12:22 AM

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

MySQL : What are the best tools to automate users creation?MySQL : What are the best tools to automate users creation?May 08, 2025 am 12:22 AM

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

MySQL: Can I search inside a blob?MySQL: Can I search inside a blob?May 08, 2025 am 12:20 AM

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc

MySQL String Data Types: A Comprehensive GuideMySQL String Data Types: A Comprehensive GuideMay 08, 2025 am 12:14 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,idealforconsistentlengthdatalikecountrycodes;2)VARCHARforvariable-lengthstrings,suitableforfieldslikenames;3)TEXTtypesforlargertext,goodforblogpostsbutcanimpactperformance;4)BINARYandVARB

Mastering MySQL BLOBs: A Step-by-Step TutorialMastering MySQL BLOBs: A Step-by-Step TutorialMay 08, 2025 am 12:01 AM

TomasterMySQLBLOBs,followthesesteps:1)ChoosetheappropriateBLOBtype(TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB)basedondatasize.2)InsertdatausingLOAD_FILEforefficiency.3)Storefilereferencesinsteadoffilestoimproveperformance.4)UseDUMPFILEtoretrieveandsaveBLOBsco

BLOB Data Type in MySQL: A Detailed Overview for DevelopersBLOB Data Type in MySQL: A Detailed Overview for DevelopersMay 07, 2025 pm 05:41 PM

BlobdatatypesinmysqlareusedforvoringLargebinarydatalikeImagesoraudio.1) Useblobtypes (tinyblobtolongblob) Basedondatasizeneeds. 2) Storeblobsin Perplate Petooptimize Performance.3) ConsidersxterNal Storage Forel Blob Romana DatabasesizerIndimprovebackupupe

How to Add Users to MySQL from the Command LineHow to Add Users to MySQL from the Command LineMay 07, 2025 pm 05:01 PM

ToadduserstoMySQLfromthecommandline,loginasroot,thenuseCREATEUSER'username'@'host'IDENTIFIEDBY'password';tocreateanewuser.GrantpermissionswithGRANTALLPRIVILEGESONdatabase.*TO'username'@'host';anduseFLUSHPRIVILEGES;toapplychanges.Alwaysusestrongpasswo

What Are the Different String Data Types in MySQL? A Detailed OverviewWhat Are the Different String Data Types in MySQL? A Detailed OverviewMay 07, 2025 pm 03:33 PM

MySQLofferseightstringdatatypes:CHAR,VARCHAR,BINARY,VARBINARY,BLOB,TEXT,ENUM,andSET.1)CHARisfixed-length,idealforconsistentdatalikecountrycodes.2)VARCHARisvariable-length,efficientforvaryingdatalikenames.3)BINARYandVARBINARYstorebinarydata,similartoC

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool