1. 程式人生 > >Oracle 如何檢視buffer_cache中快取物件使用塊的情況

Oracle 如何檢視buffer_cache中快取物件使用塊的情況

檢視buffer_cache中快取的物件要使用的檢視:

dba_objects

v$bh

1.執行下面語句,看scott使用者資料在buffer_cache快取情況。

[email protected] oracle1 as AS SYSDBA>select o.object_name,count(1) blocks from dba_objects o,v$bh bh where o.object_id=bh.objd and o.owner not in ('SYS','SYSTEM') and o.owner in ('SCOTT') group by o.object_name order by count(1);

OBJECT_NAME                                  BLOCKS
---------------------------------------- ----------
DEMO                                              5
TABLE_PARTITION                                  29

2.檢視dept表。

[email protected] oracle1 as AS SYSDBA>conn scott/tiger
Connected.
[email protected]

oracle1 as >select * from dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

3.再次檢視scott使用者在buffer_cache快取情況

[email protected] oracle1 as >conn / as sysdba
Connected.

[email protected] oracle1 as AS SYSDBA>select o.object_name,count(1) blocks from dba_objects o,v$bh bh where o.object_id=bh.objd and o.owner not in ('SYS','SYSTEM') and o.owner in ('SCOTT') group by o.object_name order by count(1);

OBJECT_NAME                                  BLOCKS
---------------------------------------- ----------
DEMO                                              5
DEPT                                              6
TABLE_PARTITION                                  29