1,在第一個(gè)圖choose monitor engine中選擇sitescope,然后在在Monitored Server Machines區(qū)域點(diǎn)擊Add可以選擇本地或者其他機(jī)器的sitescope,如果sitescope啟用了account的驗(yàn)證,也要寫上相應(yīng)的用戶名密碼。
成都創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、宜章網(wǎng)絡(luò)推廣、微信小程序開(kāi)發(fā)、宜章網(wǎng)絡(luò)營(yíng)銷、宜章企業(yè)策劃、宜章品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);成都創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供宜章建站搭建服務(wù),24小時(shí)服務(wù)熱線:18980820575,官方網(wǎng)址:www.cdcxhl.com
2,在Resource Measurements on:IP區(qū)域點(diǎn)擊添加,彈出對(duì)話框.
3,輸入信息
至此就可以監(jiān)控oracle了。
分類: Oracle
1.查看臨時(shí)表空間使用情況
Select
f.tablespace_name
,sum(f.bytes_free + f.bytes_used)
/1024/1024/1024 "total GB"
,sum((f.bytes_free + f.bytes_used) - nvl(p.bytes_used, 0))
/1024/1024/1024 "Free GB"
,sum(nvl(p.bytes_used, 0))
/1024/1024/1024 "Used GB"
from sys.v_$temp_space_header f, dba_temp_files d, sys.v_$temp_extent_pool p
where f.tablespace_name(+) = d.tablespace_name
and f.file_id(+) = d.file_id
and p.file_id(+) = d.file_id
group by
f.tablespace_name
2.查看使用臨時(shí)表空間的SQL
Select se.username,
se.sid,
su.extents,
su.blocks * to_number(rtrim(p.value)) as Space,
tablespace,
segtype,
sql_text
from v$sort_usage su, v$parameter p, v$session se, v$sql s
where p.name = 'db_block_size'
and su.session_addr = se.saddr
and s.hash_value = su.sqlhash
and s.address = su.sqladdr
order by se.username, se.sid
3.收縮臨時(shí)表空間
alter tablespace temp shrink space;
alter tablespace temp shrink tempfile ''
4.重建索引
alter index PK_CROSSRELATION rebuild;
5.查看表空間使用情況
SELECT UPPER(F.TABLESPACE_NAME) "表空間名",
D.TOT_GROOTTE_MB "表空間大小(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空間(M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') || '%' "使用比",
F.TOTAL_BYTES "空閑空間(M)",
F.MAX_BYTES "最大塊(M)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY 1;
6.查詢表空間的總?cè)萘?/p>
select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_data_files
group by tablespace_name;
7. 查詢表空間使用率
select total.tablespace_name,
round(total.MB, 2) as Total_MB,考試大論壇
round(total.MB - free.MB, 2) as Used_MB,
round((1 - free.MB / total.MB) * 100, 2) || '%' as Used_Pct
from (select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_free_space
group by tablespace_name) free,
(select tablespace_name, sum(bytes) / 1024 / 1024 as MB
from dba_data_files
group by tablespace_name) total
where free.tablespace_name = total.tablespace_name;
8. 查找當(dāng)前表級(jí)鎖的SQL如下:
select sess.sid,
sess.serial#,
lo.oracle_username,
lo.os_user_name,
ao.object_name,
lo.locked_mode
from v$locked_object lo,
dba_objects ao,
v$session sess
where ao.object_id = lo.object_id and lo.session_id = sess.sid;
殺掉鎖表進(jìn)程:
alter system kill session '436,35123';
9.監(jiān)控當(dāng)前數(shù)據(jù)庫(kù)誰(shuí)在運(yùn)行什么SQL語(yǔ)句
select osuser, username, sql_text
from v$session a, v$sqltext b
where a.sql_address =b.address order by address, piece;
10.找使用CPU多的用戶session
select a.sid,spid,status,substr(a.program,1,40) prog, a.terminal,osuser,value/60/100 value
from v$session a,v$process b,v$sesstat c
where c.statistic#=12 and
c.sid=a.sid and
a.paddr=b.addr
order by value desc;
11.查看死鎖信息
SELECT (SELECT username
FROM v$session
WHERE SID = a.SID) blocker, a.SID, 'is blocking',
(SELECT username
FROM v$session
WHERE SID = b.SID) blockee, b.SID
FROM v$lock a, v$lock b
WHERE a.BLOCK = 1 AND b.request 0 AND a.id1 = b.id1 AND a.id2 = b.id2;
12.具有最高等待的對(duì)象
SELECT o.OWNER,o.object_name, o.object_type, a.event,
SUM (a.wait_time + a.time_waited) total_wait_time
FROM v$active_session_history a, dba_objects o
WHERE a.sample_time BETWEEN SYSDATE - 30 / 2880 AND SYSDATE
AND a.current_obj# = o.object_id
GROUP BY o.OWNER,o.object_name, o.object_type, a.event
ORDER BY total_wait_time DESC;
13.查看具有最高等待的對(duì)象
SELECT a.session_id, s.osuser, s.machine, s.program, o.owner, o.object_name,
o.object_type, a.event,
SUM (a.wait_time + a.time_waited) total_wait_time
FROM v$active_session_history a, dba_objects o, v$session s
WHERE a.sample_time BETWEEN SYSDATE - 30 / 2880 AND SYSDATE
AND a.current_obj# = o.object_id
AND a.session_id = s.SID
GROUP BY o.owner,
o.object_name,
o.object_type,
a.event,
a.session_id,
s.program,
s.machine,
s.osuser
ORDER BY total_wait_time DESC;
14.查看等待最多的SQL
SELECT a.program, a.session_id, a.user_id, d.username, s.sql_text,
SUM (a.wait_time + a.time_waited) total_wait_time
FROM v$active_session_history a, v$sqlarea s, dba_users d
WHERE a.sample_time BETWEEN SYSDATE - 30 / 2880 AND SYSDATE
AND a.sql_id = s.sql_id
AND a.user_id = d.user_id
GROUP BY a.program, a.session_id, a.user_id, s.sql_text, d.username;
15.顯示正在等待鎖的所有會(huì)話
SELECT * FROM DBA_WAITERS;
windows系統(tǒng):
通過(guò)‘任務(wù)管理器’‘性能’ 即可監(jiān)控虛擬機(jī)性能。
linux系統(tǒng):
top:linux自帶的實(shí)時(shí)監(jiān)控工具,可監(jiān)控系統(tǒng)性能。
sar:監(jiān)控系統(tǒng)cpu性能
vmstat:監(jiān)控cpu、磁盤
iostat:檢測(cè)I/O設(shè)備性能
svmon:查看系統(tǒng)內(nèi)存使用情況
另外可用nagios等一些開(kāi)源監(jiān)控軟件來(lái)監(jiān)控系統(tǒng)性能
aix系統(tǒng):
topas:aix系統(tǒng)自帶的實(shí)施監(jiān)控工具(類似linux的top)
sar 1 3:監(jiān)控cpu,和linux相比需要帶上參數(shù)。(每秒刷新1次,共刷新3次)
errpt還可查看系統(tǒng)錯(cuò)誤日志。
其他監(jiān)控命令基本和linux一樣