如何检查允许连接到 Oracle 数据库的最大数量?
使用 SQL 检查 Oracle 数据库允许的最大连接数的最佳方法是什么?最后,我想显示当前的会话数和允许的总数,例如目前,使用了 80 个连接中的 23 个".
What's the best way, using SQL, to check the maximum number of connections that is allowed for an Oracle database? In the end, I would like to show the current number of sessions and the total number allowed, e.g. "Currently, 23 out of 80 connections are used".
推荐答案
在确定 Oracle 数据库支持的连接数时,可能会出现一些不同的限制.最简单的方法是使用 SESSIONS 参数和 V$SESSION,即
There are a few different limits that might come in to play in determining the number of connections an Oracle database supports. The simplest approach would be to use the SESSIONS parameter and V$SESSION, i.e.
数据库配置允许的会话数
The number of sessions the database was configured to allow
SELECT name, value
FROM v$parameter
WHERE name = 'sessions'
当前活动的会话数
SELECT COUNT(*)
FROM v$session
不过,正如我所说,在数据库级别和操作系统级别以及是否已配置共享服务器都存在其他潜在限制.如果忽略共享服务器,您很可能会在达到 SESSIONS 参数的限制之前达到 PROCESSES 参数的限制.您可能会达到操作系统限制,因为每个会话都需要一定数量的 RAM.
As I said, though, there are other potential limits both at the database level and at the operating system level and depending on whether shared server has been configured. If shared server is ignored, you may well hit the limit of the PROCESSES parameter before you hit the limit of the SESSIONS parameter. And you may hit operating system limits because each session requires a certain amount of RAM.
相关文章