tom的RUNSTATS测试工具

这里只是整理一下TOM的RUNSTATS检查工具包的脚本及使用示例,由于脚本内容较多,记录一下还是很必要的,便于日后使用翻看。

 

要运行RUNSTATSSS测试工具,必须有访问V$STATNAME,V$MYSTAT,V$LATCH的权限。

还必须有对SYS.V_$STATNAME,SYS.V_$MYSTAT,SYS.V_$LATCH的直接权限(不是通过角色授权)。

create or replace view stats

as

select 'STAT...'||a.NAME AS name, b.VALUE as value

from v$statname a, v$mystat b

where a.STATISTIC# = b.STATISTIC#

union all

select 'latch'||name as name, gets as value

from v$latch;

 

创建一张存储这些统计信息的小表:

create global temporary table run_stats
(
       runid varchar2(15),
       name varchar2(80),
       value int
) on commit preserve rows;

 

-- 创建 runstats 包。其中包括 3 个简单 API 调用:
create or replace package runstats_pkg
as
   procedure rs_start;
   procedure rs_middle;
   procedure rs_stop(p_difference_threshold in number default 0);
end;

/

create or replace package body runstats_pkg
as
-- 这些全局变量用于纪录每次运行的耗用时间:
  g_start number;
  g_run1 number;
  g_run2 number;

  procedure rs_start
  is
  begin
        delete from run_stats;
        insert into run_stats
        select 'before', stats.* from stats;
        g_start := dbms_utility.get_time;
  end;

 

procedure rs_middle
  is
  begin
        g_run1 := (dbms_utility.get_time - g_start);
        insert into run_stats
        select 'after 1',stats.* from stats;
        g_start := dbms_utility.get_time;
  end;

 

procedure rs_stop(p_difference_threshold in number default 0)
  is
  begin
      g_run2 := (dbms_utility.get_time - g_start);
      dbms_output.put_line('Run1 ran in'||g_run1||'hsecs');
      dbms_output.put_line('Run2 ran in'||g_run2||'hsecs');
      dbms_output.put_line('run 1 ran in '||round(g_run1/g_run2*100,2)||'%of the time');
      dbms_output.put_line(chr(9));
      
      insert into run_stats
      select 'after 2', stats.* from stats;
      dbms_output.put_line( rpad('Name',30)|| lpad('Run1',10)||
                            lpad('Run2',10)|| lpad('Diff',10));
      for x in
      (
          select rpad(a.name,30)||
                 to_char(b.value - a.value,'9,999,999')||
                 to_char(c.value - b.value,'9,999,999')||
                 to_char(((c.value - b.value)-(b.value - a.value)),'9,999,999') data
          from run_stats a, run_stats b, run_stats c
          where a.name = b.name
          and b.name = c.name
          and a.runid = 'before'
          and b.runid = 'after 1'
          and c.runid = 'after 2'
          and (c.value - a.value) > 0
          and abs((c.value - b.value) - (b.value - a.value)) > p_difference_threshold
          order by abs((c.value - b.value)-(b.value - a.value))
      ) loop
        dbms_output.put_line(x.data);
      end loop;
      
      dbms_output.put_line(chr(9));
      dbms_output.put_line('Run1 latches total versus runs -- difference and pct ');
      dbms_output.put_line( lpad('Run1',10) || lpad('Run2',10) ||
                            lpad('Diff',10) || lpad('Pct',8));
      for x in
      (
          select to_char(run1, '9,999,999')||
                 to_char(run2, '9,999,999')||
                 to_char(diff, '9,999,999')||
                 to_char(round(run1/run2*100,2), '999.99')||'%' data
          from (
               select sum(b.value - a.value) run1,
                      sum(c.value - b.value) run2,
                      sum((c.value - b.value) - (b.value - c.value)) diff
               from run_stats a, run_stats b, run_stats c
               where a.name = b.name
               and b.name = c.name
               and a.runid = 'before'
               and b.runid = 'after 1'

and c.runid = ‘after 2’
               and a.name like 'latch%'
          )
      )loop
           dbms_output.put_line(x.data);
      end loop;           
  end;
end;

/

 

以上可以考虑在SYS用户下创建,之后创建runstats_pkg的public synonym即可。

 

使用实例:

使用Scott/tiger用户:

SQL> drop table heap;

 

表已丢弃。

 

SQL> drop table iot;

 

表已丢弃。

 

SQL> create table heap (dummy )

  2  as select * from dual;

 

表已创建。

 

SQL> ed

已写入文件 afiedt.buf

 

  1  create table iot(dummy primary key)

  2  organization index

  3* as select dummy from dual

SQL> /

 

表已创建。

 

SQL> analyze table heap compute statistics;

 

表已分析。

 

SQL> analyze table iot compute statistics;

 

表已分析。

 

SQL> exec runstats_pkg.rs_start;

 

PL/SQL 过程已成功完成。

 

SQL> ed

已写入文件 afiedt.buf

 

  1  declare

  2  x varchar2(1);

  3  begin

  4  for i in 1..10000 loop

  5  select dummy into x

  6  from heap;

  7  end loop;

  8* end;

SQL> /

 

PL/SQL 过程已成功完成。

 

SQL> exec runstats_pkg.rs_middle;

 

PL/SQL 过程已成功完成。

 

SQL> ed

已写入文件 afiedt.buf

 

  1  declare

  2  x varchar2(1);

  3  begin

  4  for i in 1..10000 loop

  5  select dummy into x

  6  from iot;

  7  end loop;

  8* end;

SQL> /

 

PL/SQL 过程已成功完成。

 

SQL> set serveroutput on size 1000000

SQL> exec runstats_pkg.rs_stop;

Run1 ran in7480hsecs                                                           

Run2 ran in3131hsecs                                                           

run 1 ran in 238.9%of the time                                                 

                                                                                     

Name                                Run1      Run2      Diff                   

STAT...SQL*Net roundtrips to/f         6         5        -1                   

STAT...active txn count during         3         4         1                   

STAT...calls to kcmgcs                 3         4         1                   

STAT...cleanout - number of kt         3         4         1                   

STAT...db block gets                 525       524        -1                   

STAT...opened cursors cumulati        14        13        -1                   

STAT...user calls                      9         8        -1                   

latchktm global data                   0         1         1                   

latchmessage pool operations p         0         1         1                   

latchsort extent pool                  1         2         1                   

latchsimulator lru latch               1         0        -1                   

latchsimulator hash latch              1         0        -1                   

latchsession idle bit                 22        21        -1                   

latchobject stats modification         0         1         1                   

latchkwqit: protect wakeup tim         2         1        -1                   

latchfile number translation t         0         1         1                   

STAT...parse count (failures)          1         0        -1                   

STAT...free buffer requested           5         4        -1                   

STAT...cursor authentications          1         0        -1                   

STAT...consistent gets - exami        11        12         1                   

STAT...consistent changes            491       493         2                   

STAT...db block changes            1,014     1,012        -2                    

STAT...parse time elapsed              2         0        -2                   

STAT...parse time cpu                  2         0        -2                   

STAT...immediate (CURRENT) blo         4         0        -4                    

latchchild cursor hash table          19        15        -4                   

STAT...redo entries                  505       501        -4                   

STAT...CPU used by this sessio        26        21        -5                   

STAT...CPU used when call star        26        21        -5                   

latchenqueues                         94        87        -7                   

STAT...deferred (CURRENT) bloc         0         9         9                   

latchConsistent RBA                   37        27       -10                   

latchsession timer                    25        11       -14                   

latchactive checkpoint queue l        27        10       -17                   

latchpost/wait queue                  74        54       -20                   

latchlgwr LWN SCN                     56        33       -23                   

latchmostly latch-free SCN            56        33       -23                   

latchchannel operations parent        48        23       -25                   

latchcache buffers lru chain          56        29       -27                   

latchrow cache enqueue latch         128       164        36                   

latchrow cache objects               134       170        36                   

latchredo writing                    189       112       -77                   

latchsession allocation              188       100       -88                   

latchundo global data                371       246      -125                   

STAT...redo size                  65,224    65,364       140                   

latchmessages                        332       180      -152                   

latchlibrary cache pin allocat       442       272      -170                   

latchredo allocation                 866       696      -170                   

latchdml lock allocation             391       203      -188                   

latchlibrary cache pin            20,627    20,410      -217                    

latchenqueue hash chains             662       378      -284                   

STAT...bytes received via SQL*     1,448     1,137      -311                   

latchshared pool                  10,791    10,476      -315                    

latchlibrary cache                21,176    20,748      -428                   

STAT...bytes sent via SQL*Net      1,245       693      -552                   

latchcheckpoint queue latch        1,298       502      -796                   

latchSQL memory manager workar     1,608       670      -938                   

STAT...buffer is not pinned co    10,001         1   -10,000                   

STAT...index scans kdiixs1            10    10,010    10,000                   

STAT...table scan blocks gotte    10,000         0   -10,000                   

STAT...table scans (short tabl    10,000         0   -10,000                   

STAT...table scan rows gotten     10,000         0   -10,000                   

STAT...shared hash latch upgra        10    10,010    10,000                   

STAT...no work - consistent re    10,001         1   -10,000                   

STAT...consistent gets            30,026    10,027   -19,999                   

STAT...calls to get snapshot s    30,018    10,018   -20,000                   

STAT...session logical reads      30,551    10,551   -20,000                   

latchcache buffers chains         65,336    24,057   -41,279                   

                                                                                      

Run1 latches total versus runs -- difference and pct                           

Run1      Run2      Diff     Pct                                               

125,072    79,748   159,496 156.83%                                             

 

PL/SQL 过程已成功完成。

 

SQL> spool off

以下是对提供的参考资料的总结,按照要求结构化多个要点分条输出: 4G/5G无线网络优化与网规案例分析: NSA站点下终端掉4G问题:部分用户反馈NSA终端频繁掉4G,主要因终端主动发起SCGfail导致。分析显示,在信号较好的环境下,终端可能因节能、过热保护等原因主动释放连接。解决方案建议终端侧进行分析处理,尝试关闭节电开关等。 RSSI算法识别天馈遮挡:通过计算RSSI平均值及差值识别天馈遮挡,差值大于3dB则认定有遮挡。不同设备分组规则不同,如64T和32T。此方法可有效帮助现场人员识别因环境变化引起的网络问题。 5G 160M组网小区CA不生效:某5G站点开启100M+60M CA功能后,测试发现UE无法正常使用CA功能。问题原因在于CA频点集标识配置错误,修正后测试正常。 5G网络优化与策略: CCE映射方式优化:针对诺基亚站点覆盖农村区域,通过优化CCE资源映射方式(交织、非交织),提升RRC连接建立成功率和无线接通率。非交织方式相比交织方式有显著提升。 5G AAU两扇区组网:与三扇区组网相比,AAU两扇区组网在RSRP、SINR、下载速率和上传速率上表现不同,需根据具体场景选择适合的组网方式。 5G语音解决方案:包括沿用4G语音解决方案、EPS Fallback方案和VoNR方案。不同方案适用于不同的5G组网策略,如NSA和SA,并影响语音连续性和网络覆盖。 4G网络优化与资源利用: 4G室分设备利旧:面对4G网络投资压减与资源需求矛盾,提出利旧多维度调优策略,包括资源整合、统筹调配既有资源,以满足新增需求和提质增效。 宏站RRU设备1托N射灯:针对5G深度覆盖需求,研究使用宏站AAU结合1托N射灯方案,快速便捷地开通5G站点,提升深度覆盖能力。 基站与流程管理: 爱立信LTE基站邻区添加流程:未提供具体内容,但通常涉及邻区规划、参数配置、测试验证等步骤,以确保基站间顺畅切换和覆盖连续性。 网络规划与策略: 新高铁跨海大桥覆盖方案试点:虽未提供详细内容,但可推测涉及高铁跨海大桥区域的4G/5G网络覆盖规划,需考虑信号穿透、移动性管理、网络容量等因素。 总结: 提供的参考资料涵盖了4G/5G无线网络优化、网规案例分析、网络优化策略、资源利用、基站管理等多个方面。 通过具体案例分析,展示了无线网络优化中的常见问题及解决方案,如NSA终端掉4G、RSSI识别天馈遮挡、CA不生效等。 强调了5G网络优化与策略的重要性,包括CCE映射方式优化、5G语音解决方案、AAU扇区组网选择等。 提出了4G网络优化与资源利用的策略,如室分设备利旧、宏站RRU设备1托N射灯等。 基站与流程管理方面,提到了爱立信LTE基站邻区添加流程,但未给出具体细节。 新高铁跨海大桥覆盖方案试点展示了特殊场景下的网络规划需求。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值