MySQL、Oracle数据库如何查看最大连接数和当前连接数

来自:网络
时间:2024-06-07
阅读:
免费资源网 - https://freexyz.cn/

1. MySQL

-- 查看最大连接数
show variables like 'max_connections';
select @@max_connections;
-- select * from performance_schema.session_variables   where VARIABLE_NAME in ('max_connections');
-- select * from performance_schema.global_variables    where VARIABLE_NAME in ('max_connections');
-- select * from performance_schema.persisted_variables where VARIABLE_NAME in ('max_connections');
-- 查看当前连接数
show status like 'Threads_connected';
select count(1) from processlist;

MySQL、Oracle数据库如何查看最大连接数和当前连接数

2. Oracle

-- 允许最大进程数、连接数
select name,value from v$parameter where name in('processes' ,'sessions');
-- 当前进程数、连接数
select count(1) from v$session;
select count(1) from v$process;

MySQL、Oracle数据库如何查看最大连接数和当前连接数

附:Oracle连接数的调整

1. 查看最大连接数

您可以使用以下任意一个方法来查询:

show parameter processes;

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

2. 查看当前连接数

select count(*) from v$process;

3. 调整最大连接数

与共享池大小一样,建议您根据实际需求进行调整。

alter system set processes=1000 scope=spfile;

调整完毕后,请重启数据库服务以使更改生效。

总结 

免费资源网 - https://freexyz.cn/
返回顶部
顶部