日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > 数据库 >内容正文

数据库

oracle活跃用户,监控数据库中的活跃用户及其运行

發(fā)布時(shí)間:2025/3/8 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle活跃用户,监控数据库中的活跃用户及其运行 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓

[sql] view plain copy print?

set linesize 120 pagesize 66

col c1 for a9

col c1 heading "OS User"

col c2 for a9

col c2 heading "Oracle User"

col b1 for a9

col b1 heading "Unix PID"

col b2 for 9999 justify left

col b2 heading "SID"

col b3 for 99999 justify left

col b3 heading "SERIAL#"

col sql_text for a35

col event for a30

break on b1 nodup on c1 nodup on c2 nodup on b2 nodup on b3 skip 3

select c.spid b1,

b.osuser c1,

b.username c2,

b.sid b2,

b.serial# b3,

b.event,

a.sql_text

from v$sqltext a, v$session b, v$process c

where a.address = b.sql_address

-- and b.status = 'ACTIVE' /* YOU CAN CHOOSE THIS OPTION ONLY TO SEE

-- ACTVE TRANSACTION ON THAT MOMENT */

and b.paddr = c.addr

and a.hash_value = b.sql_hash_value

order by c.spid, a.hash_value, a.piece

/

REM TOP SESSION

with sessions as

(select /*+ materialize */

sess.inst_id,

sess.sid,

sess.serial#,

sess.username,

sess.module,

sess.program,

stat.value cpu_used_by_this_session,

i.physical_reads,

i.block_gets,

sess.command,

sess.status,

sess.lockwait,

decode(sess.sql_hash_value, 0, sess.prev_hash_value, sess.sql_hash_value) sql_hash_value,

decode(sess.sql_address, '00', sess.prev_sql_addr, sess.sql_address) sql_address

from gv$sesstat stat, gv$session sess, gv$sess_io i

where stat.statistic# =

(select statistic#

from v$statname

where name = 'CPU used by this session')

and stat.sid = sess.sid

and stat.inst_id = sess.inst_id

and (stat.value > 100 or i.physical_reads > 100 or i.block_gets > 100)

and sess.username is not null

and i.sid = sess.sid

and i.inst_id = sess.inst_id),

sqlarea as

(select inst_id, sql_fulltext sql_text, hash_value, address from gv$sqlarea)

select *

from sessions, sqlarea

where sessions.inst_id = sqlarea.inst_id and sessions.sql_hash_value = sqlarea.hash_value and sessions.sql_address = sqlarea.address

order by cpu_used_by_this_session desc

總結(jié)

以上是生活随笔為你收集整理的oracle活跃用户,监控数据库中的活跃用户及其运行的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。