oracle sys.standard,oracle系统性能指标(sysmetric)

v$sysmetric and v$sysmetric_historyOracle Tips by Burleson Consulting

Oracle10g v$sysmetric and v$sysmetric_history

Database workload metrics describe different aspects of database workload activity. Two examples are the number of calls per second and the physical reads per transaction. These metrics help the DBA monitor the database and estimate how effectively it operates at any given moment in time, and thev$sysmetric_history,v$sysmetric, andv$sysmetric_summarydynamic performance views allow us access to information about these metrics.

As we see, the AWR captures snapshots ofv$sysmetric_historywhich are available through thedba_hist_sysmetric_historyview.

One great benefit of thev$sysmetric_historyview is that it helps monitor the database workload in real time. It is very simple to build real time charts based on this view. For example, theIon toolprovides such functionality as the plotting of real time charts for metrics with both short and long durations. The example in Figure 7.2 shows how Ion monitors metrics in real time:

Figure 7.2:Monitoring workload database metrics in real time using Ion.

Using a visual representation of database workload, it is simple to find correlations between the behaviors of database workload metrics and wait events that are caused by database processing. For example, if there are high values for log file switch completion or log file sync wait events, it is worth the DBA’s time to view the workload for the Redo Generated Per Second metric in order to estimate the impact of the redo workload on these wait events.

Thev$sysmetricview is similar to thev$sysmetric_historyview, but it reports metric values for only the most current time sample. Both long and short duration metrics are available in thev$sysmetricview.

The v$sysmetric_summaryview is also similar to thev$sysmetric_historyview, but it has additional columns and it displays such summary information as minimum, maximum, and average values of database metrics as well as their standard deviations. These summary values are computed for the number of sample intervals included in thenum_intervalscolumn. Thev$sysmetric_summaryview reports data only for database metrics that belong to the System Metrics Long Duration metric group. This view can be used to build alert reports. For example, the followingmetric_values.sqlquery shows database metrics that have more than 15 percent growth in their current value compared to average value:

SELECT

to_char(m.begin_time,'hh24:mi') "start time",

to_char(m.end_time,'hh24:mi')   "end time",

m.value                         "current value",

s.average                       "average value",

m.metric_name,

m.metric_unit

FROM

v$sysmetric         m,

v$sysmetric_summary s

WHERE

SEE CODE DEPOT FOR FULL SCRIPTS

AND s.average > 0

AND ((m.value - s.average)/s.average)*100 >= 10

AND lower(m.metric_name) NOT LIKE '%ratio%';

The following output shows the current and average values for metrics of interest to the DBA:

Start End T Curr Val Avg Val METRIC_NAME            METRIC_UNIT

----- ----- -------- ------- ---------------------- -----------------------

15:42 15:43       29      18 User Calls Per Txn     Calls Per Txn

15:42 15:43       63      31 Rows Per Sort          Rows Per Sort

15:42 15:43        5       3 CPU Usage Per Sec      CentiSeconds Per Second

15:42 15:43      294     180 CPU Usage Per Txn      CentiSeconds Per Txn

15:42 15:43       29      26 Current Logons Count   Logons

15:42 15:43      301     225 Response Time Per Txn  CentiSeconds Per Txn

15:42 15:43       17      15 Process Limit %        % Processes/Limit

15:42 15:43       18      16 Session Limit %        % Sessions/Limit

15:42 15:43        5       3 Database Time Per Sec  CentiSeconds Per Second

15:43 15:43       21      18 User Calls Per Txn     Calls Per Txn

15:43 15:43        7       3 Database Time Per Sec  CentiSeconds Per Second

Using the above script output, the DBA is able to identify the database metrics that have significantly changed from their average values. This report can point a DBA to some exceptional activity occurring in the database.

The AWR also takes snapshots for thev$sysmetric_summaryview that are available through thedba_hist_sysmetric_summaryview.

It is also possible to monitor database metrics on a per session basis. Thev$sessmetricview contains a single row per current session and reports the following metrics:

§CPU usage by session.

§Number of physical reads.

§PGA memory consumption.

§Numbers of hard and soft parses.

§Physical and logical read ratios.

Using this view, database sessions can be monitored for extra resource consumption. For example, thecpu_hot_sessions.sqlquery below returns a list of sessions which consume CPU time more than one percent of total database CPU time:

select

s.sid,

s.username

FROM

v$sessmetric sm,

v$session    s

WHERE

s.sid = sm.session_id

AND

(sm.cpu/(SELECT decode(value,0,-1)

FROM

v$sysmetric

WHERE

SEE CODE DEPOT FOR FULL SCRIPTS

The output of this query might look like:

SID    USERNAME

------ --------------------------

33     SCOTT

19     SYSTEM

Using the above output, a DBA is able to quickly identify sessions consuming extra CPU resources.

Now that database metrics used to describe database workload activity have been introduced, it is time to look at the metrics available in Oracle10g that show times database was waiting for something.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值