数据库管理Oracle 连接池信息的修改
最近项目中用到的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
到此,连接池的设置和相关修改已经完成。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.
