成都网站建设设计

将想法与焦点和您一起共享

oracle性能怎么监控,查看oracle性能

监控oracle11g数据库性能有哪些方式?

这个很多啊。

目前累计服务客户成百上千,积累了丰富的产品开发及服务经验。以网站设计水平和技术实力,树立企业形象,为客户提供成都网站设计、网站制作、外贸营销网站建设、网站策划、网页设计、网络营销、VI设计、网站改版、漏洞修补等服务。创新互联公司始终以务实、诚信为根本,不断创新和提高建站品质,通过对领先技术的掌握、对创意设计的研究、对客户形象的视觉传递、对应用系统的结合,为客户提供更好的一站式互联网解决方案,携手广大客户,共同发展进步。

1、监控表空间的I/O比例

2、监控事例的等待时间

3、监控 SGA 的命中率

4、监控 SGA 中共享缓存区的命中率

5、碎片程度监控

等等。。。。。。。。。。

如何查询Oracle性能监控

1.查看临时表空间使用情况

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.查看使用临时表空间的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.收缩临时表空间

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.查询表空间的总容量

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. 查找当前表级锁的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;

杀掉锁表进程:

alter system kill session '436,35123';

9.监控当前数据库谁在运行什么SQL语句

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.具有最高等待的对象

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.查看具有最高等待的对象

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.显示正在等待锁的所有会话

SELECT * FROM DBA_WAITERS;

oracle vm server怎么监控虚拟机性能

windows系统:

通过‘任务管理器’‘性能’ 即可监控虚拟机性能。

linux系统:

top:linux自带的实时监控工具,可监控系统性能。

sar:监控系统cpu性能

vmstat:监控cpu、磁盘

iostat:检测I/O设备性能

svmon:查看系统内存使用情况

另外可用nagios等一些开源监控软件来监控系统性能

aix系统:

topas:aix系统自带的实施监控工具(类似linux的top)

sar 1 3:监控cpu,和linux相比需要带上参数。(每秒刷新1次,共刷新3次)

errpt还可查看系统错误日志。

其他监控命令基本和linux一样


名称栏目:oracle性能怎么监控,查看oracle性能
文章链接:http://chengdu.cdxwcx.cn/article/dsihesd.html