怎样查看oracle当前的连接数

怎样查看oracle当前的连接数,第1张

-- 当前的连接数

SQL> select count(*) from v$session 

-- #并发连接数

SQL> Select count(*) from v$session where status='ACTIVE'

--数据库允许的最大连接数

SQL> select value from v$parameter where name = 'processes'

-- #最大连接

SQL> show parameter processes 

-- #查看不同用户的连接数

SQL> select username,count(username) from v$session where username is not null group by username

用putty连接linux服务器,切换到

su

-

oracle

sqlplus

/nolog

连接到数据库;

conn

/

as

sysdba

show

parameter

session

alter

system

set

sessions

=

values(比如400)

scope

=

spfile//注意此处的分号;

show

parameter

process

alter

system

set

processes

=

values(比如450)scope

=

spfile//注意此处的分号;

show

parameter

license

//查看最大的process;

重新启动服务器;

oracle的连接数(sessions)与其参数文件中的进程数(process)有关,它们的关系如下:

sessions=(1.1*process+5)

但是我们增加process数时,往往数据库不能启动了。这因为我们还漏调了一个unix系统参数:它是/etc/system/中semmns,这是unix系统的信号量参数。每个process会占用一个信号量。semmns调整后,

需要重新启动unix *** 作系统,参数才能生效。不过它的大小会受制于硬件的内存或oracle

sga。范围可从200——2000不等。

semmns的计算公式为:semmns>processes+instance_processes+system

processes=数据库参数processes的值

instance_processes=5(smon,pmon,dbwr,lgwr,arch)

system=系统所占用信号量。系统所占用信号量可用下列命令查出:#ipcs

-sb

查看session:

select * from v$session where username is not null

select username,count(username) from v$session where username is not null group by username

当前连接数:

select count(*) from v$process

查看连接数参数的设置情况

select value from v$parameter where name = 'processes'

Select count(*) from v$session where status='ACTIVE' #并发连接数


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/10812005.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-11
下一篇 2023-05-11

发表评论

登录后才能评论

评论列表(0条)

保存