MySQL、Oracle查看最大连接数和当前连接数

82 阅读1分钟

@[toc]


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;

在这里插入图片描述

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;

在这里插入图片描述