1、查询命令
--1、根据数据库、进程获取当前oracle数据库连接session,注意username
select *from v$session where username='NGSOFT' and program='w3wp.exe' ORDER BY PREV_exec_start
--2、打印当前连接数,查看当前连接池是否超出,oracle连接池可设置1000,注意username
select count(*)from v$session where username='NGSOFT' and program='w3wp.exe' ORDER BY PREV_exec_start
--3、根据sql_id获取sql语句
select * from v$sql where sql_id='gj82qu4h997uj'
2、 其它常用命令
--查询数据库当前进程的连接数:
select count() from v$process; --查看数据库当前会话的连接数: select count() from v$session;
--查看数据库的并发连接数:
select count(*) from v$session where status='ACTIVE';
--查询数据库允许的最大连接数:
select value from v$parameter where name = 'processes';
--修改数据库允许的最大连接数:
alter system set processes = 300 scope = spfile;
--查看当前有哪些用户正在使用数据:
select osuser,a.username,cpu_time/executions/1000000||'s',sql_fulltext,machine
from v$session a,v$sqlarea b
where a.sql_address = b.address
order by cpu_time/executions desc;
--查询数据库当前进程的连接数:host_process_id--w3wp
select count(*),host_process_id from sys.dm_exec_sessions group by host_process_id
select 'dbcc inputbuffer(' +cast(session_id as varchar) +')',session_id,last_request_start_time,login_time,last_request_end_time
from sys.dm_exec_sessions where host_process_id='1360' order by last_request_start_time asc
select * from sys.dm_exec_sessions where host_process_id='5800'
dbcc inputbuffer(51)
————————————————
原文链接:https://blog.csdn.net/LongtengGensSupreme/article/details/118760101