设为首页 加入收藏

TOP

[20190214]11g Query Result Cache RC Latches补充.txt(一)
2019-09-17 18:08:27 】 浏览:70
Tags:20190214 11g Query Result Cache Latches 补充 .txt

[20190214]11g Query Result Cache RC Latches补充.txt

--//上午测试链接:http://blog.itpub.net/267265/viewspace-2632907/
--//发现自己的一个错误,另外写一篇帖子更正.
--//顺便复习result cache的相关内容:链接:https://blog.csdn.net/jolly10/article/details/81382644

查看SQL结果高速缓存字典信息
(G)V$RESULT_CACHE_STATISTICS : 列出各种高速缓存设置和内存使用量统计信息
(G)V$RESULT_CACHE_MEMORY : 列出所有内存块和相应的统计信息
(G)V$RESULT_CACHE_OBJECTS: 列出所有对象(高速缓存结果和依赖性)及其属性
(G)V$RESULT_CACHE_DEPENDENCY: 列出高速缓存结果之间的依赖性详细信息及依赖性

dbms_result_cache包可以监视和管理result cache

例如:
dbms_result_cache.flush:清除result cache。
dbms_result_cache.invalidate(owner,name):使某对象的result cache无效。
dbms_result_cache.status:显示result cache的状态。
dbms_result_cache.memory_report:显示result cache的内存使用状况。

1.环境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> create table job_times ( sid   number, time_ela number);
Table created.

SCOTT@book> create table hc_t ( n number(*,0), v varchar2(200)) ;
Table created.

SCOTT@book> insert into hc_t select level, dbms_random.string('p', 200) from dual connect by level <= 10000;
10000 rows created.

SCOTT@book> create unique index i_hc_t on hc_t(n);
Index created.

SCOTT@book> commit;
Commit complete.

--//分析表略.

create or replace procedure do_rc(
 p_iterations in number,p_max in number
) is
 l_rowid  rowid;
 l_n number;
begin
 insert into job_times
  values (sys_context('userenv', 'sid'), dbms_utility.get_time)
  returning rowid into l_rowid;

 for i in 1 .. p_iterations
 loop
  l_n:=trunc(dbms_random.value(1, p_max));
  for cur in (select /*+ result_cache */ * from hc_t where n=l_n)
  loop
   null;
  end loop;
 end loop;

 update job_times set
   time_ela=dbms_utility.get_time-time_ela
  where rowid=l_rowid;
end;
/
--//注:我加入参数p_max,限制取值范围.
--//为了重复测试建立脚本.
$ cat aa.sql
delete from job_times;
Commit ;

declare
 l_job number;
begin
 for i in 1 .. 4
 loop
  dbms_job.submit(
   job => l_job,
   what => 'do_rc(100000,&&1);'
    );
 end loop;
end;
/
commit ;

2.开始测试:
SCOTT@book> show parameter result
NAME                                 TYPE         VALUE
------------------------------------ ------------ ----------
client_result_cache_lag              big integer  3000
client_result_cache_size             big integer  0
result_cache_max_result      &nbs

首页 上一页 1 2 3 4 下一页 尾页 1/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇[20190214]11g Query Result Cach.. 下一篇(一)MYSQL ERROR 2003 (HY000):..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目