To keep query in buffer cache

i want to ask how to keep a query in buffer cache always?
a query which runs frequently in a database will always stay in buffer cache due to LRU. LRU will not allow that query to flush out form buffer cache as it is running frequently.but if i want to place a query explicitly in buffer cache what should i do?please answer it soon..

i have recently completed the ORACLE DBA courseware and in an interview the interviewer asked me that if he want to place a query explicitly in buffer cache what will i do?
as a fresher my knowledge is limited and i am trying to improve it continuously..
while the interviewer was a senior oracle DBA, according to my knowledge i told him that we can keep objects like tables indexes in keep cache by declaring so or if the same query is running continuously it will automatically remain in LRU .putting a query is a new stuff i was searching for it but i wasn't getting answer for it so finally i decided to put this question on forum...
i am trying hard to get a job as a DBA but all in vain i am nt getting one really it's becoming frustrating for me i have great hopes on oracle and besides hope i like learning oracle from beginning of my graduation thats y i decided to make my career in oracle and specially a DBA...
now let's see what happens....

Similar Messages

  • DB buffer cache vs. SQL query & PL/SQL function result cache

    Hi all,
    Started preparing for OCA cert. just myself using McGraw Hill's exam guide. Have a question about memory structures.
    Actually, DB buffer cache is used to copy e.g. SELECT queries result data blocks, that can be reused by another session (server process).
    There is also additional otion - SQL query & PL/SQL function result cache (from 11g), where also stored the results of such queries.
    Do they do the same thing or nevertheless there is some difference, different purpose?
    thanks in advance...

    There is also additional otion - SQL query & PL/SQL function result cache (from 11g), where also stored the results of such queries.Result cache located in shared pool.So it is one component of shared pool.When server process execute query(and if you configured result cache) then result will store in shared pool.Then next execution time run time mechanism will detect and consider using result cache without executing this query(if data was not changed this is happen detection time)
    Do they do the same thing or nevertheless there is some difference, different purpose?.Buffer cache and result cache are different things and purpose also,but result cache introduced to improve response time of query in 11g(but such mechanism also implemented in 10g subquery execution,in complex query).In buffer cache holds data blocks but not such results.
    Edited by: Chinar on Nov 4, 2011 4:40 AM
    (Removing lots of "But" word from sentences :-) )

  • How data buffer cache is handled

    hi all,
    I have a doubt in how buffer cache is managed.. I read that server process will read blocks from data file and keeps them in buffer cache if they are not already present in buffer cache.. Suppose two users from different sessions issue the same statement at the same time, and they are picked up by different server processes, and upon checking they will find that the block is not present in SGA, so they both will go read the block.. is it not unnecessary.. or am i wrong? please let me know how it is handled.
    Regards
    Suresh

    Hi tinku,
    I understand what you mean.. but my problem is different.
    suppose there are two sessions
    first session issues a statement:
    Select * from emp where empno = 12;
    and second session issues
    select * from emp where empno in (12,13);
    becoz these two statements are different, these two statements are to be parsed separately. After parsing, each of the server processes will see if the block corresponding 12 is already in memory, if it is not, they will read it from data file and keep in buffer cache.. suppose these two server processes at the same time find that the block is not in SGA and try to read the block from data file, there would be two copies of the block in SGA. isn't it. I don't think this is what is gonna happen. so i need how the server processes coordinate with each other to read only necessary blocks without redundancy.
    Regards
    Suresh

  • Keep Buffer Cache Not Large Enough

    What happens if I pin a table/index in the keep buffer cache but the keep buffer cache is not large enough? How does oracle determine what to initially put into the keep buffer cache and what to leave out?

    >
    Well, I got some of them directly from the Oracle docs:
    “A good candidate for a segment to put into the KEEP
    pool is a segment that is smaller than 10% of the
    size of the DEFAULT buffer pool and has incurred at
    least 1% of the total I/Os in the system”.
    But the rules you quoted in your previous post were - not the rule you got from Oracle !
    - Use the KEEP pool if the object consumes more than 10% of the total size of the data buffer.
    - Use the KEEP pool if more than 50% of the objects blocks already resides in the data buffer, according to an x$bh query.
    But I agree, I use my own set of decision rules, which vary by system.
    There is no "one size fits all" set of rules . . . . . But you just said you use the rules you got from Oracle in the previous post that:
    The placement criteria for tables and indexes into the KEEP buffer are straightforward:
    Please make up your mind.
    By the way, your script hot_buffers.sql from the page you mentioned above has a few errors in it. The join between x$bh and dba_objects should be on data_object_id, not on object_id; and by joining dba_objects to dba_segments on object_name = segment_name you've introduced a lot of errors relating to index-organised tables, partitioned tables, clusters etc.
    Please see Metalink note: 135223.1. Although it's got a couple of things in it that appeared back in the days of 8i (the original document was written in 1998 I believe) it has a better analysis of the issues.
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • Sql query executes faster 2. time despite clearing buffer cache/shared pool

    Hi All,
    I want to test query performance, so i clear cache in following way before each execution:
    alter system flush buffer_cache;
    alter system flush shared_pool;
    But, first execution takes more time than second and consequent executions. For example first execution takes 30 seconds, consequent executions take 3 seconds.
    Before each execution I clear the cache.
    What can be the reason? I use TOAD for query execution. Does TOAD caches something after first execution?
    And last question. Is there a dynamic query that query execution duration is stored?
    Any help will be appreciated.
    Thanks.

    >
    So there shouldn't be problem from the parameter, can you post result from V$SGA_DYNAMIC_COMPONENTS and v$SGAINFO ?
    V$SGA_DYNAMIC_COMPONENTS
    COMPONENT CURRENT_SIZE MIN_SIZE MAX_SIZE USER_SPECIFIED_SIZE OPER_COUNT LAST_OPER_TYP LAST_OPER LAST_OPER GRANULE_SIZE
    shared pool 436207616 402653184 0 0 125 GROW IMMEDIATE 02-JUL-09 16777216
    large pool 201326592 117440512 0 83886080 12 SHRINK DEFERRED 02-JUL-09 16777216
    java pool 16777216 16777216 0 0 0 STATIC 16777216
    streams pool 16777216 16777216 0 0 0 STATIC 16777216
    DEFAULT buffer cache 1895825408 1711276032 0 16777216 137 GROW DEFERRED 02-JUL-09 16777216
    KEEP buffer cache 0 0 0 0 0 STATIC 16777216
    RECYCLE buffer cache 0 0 0 0 0 STATIC 16777216
    DEFAULT 2K buffer cache 0 0 0 0 0 STATIC 16777216
    DEFAULT 4K buffer cache 0 0 0 0 0 STATIC 16777216
    DEFAULT 8K buffer cache 0 0 0 0 0 STATIC 16777216
    DEFAULT 16K buffer cache 0 0 0 0 0 STATIC 16777216
    DEFAULT 32K buffer cache 0 0 0 0 0 STATIC 16777216
    ASM Buffer Cache 0 0 0 16777216 0 STATIC 16777216
    V$SGA_INFO
    NAME BYTES RESIZEABL
    Fixed SGA Size 2086392 No
    Redo Buffers 14688256 No
    Buffer Cache Size 1895825408 Yes
    Shared Pool Size 436207616 Yes
    Large Pool Size 201326592 Yes
    Java Pool Size 16777216 Yes
    Streams Pool Size 16777216 Yes
    Granule Size 16777216 No
    Maximum SGA Size 2634022912 No
    Startup overhead in Shared Pool 218103808 No
    Free SGA Memory Available 50331648

  • Buffer cache hit ratio query

    Hi,
    I would appreciate some advice please.
    My Oracle 10.2.0.4.0 database starts off in the day with a buffer cache hit ratio of almost 100% but this drops gradually in the course of the day as the system gets busier. Is this something I need to be concerned about if no performance problem has been reported by the users?
    I would have thought this should be a normal situation, i.e. as the system gets busier, I would expect that less number of calls to the buffer cache will be satisfied because many more calls are using up the memory?
    Please note that I've done some reading up on this but would like some suggestions from more experienced people than myself on what I should normally expect and what should or should not be a concern.
    thanks

    user8869798 wrote:
    hi,
    thanks again for your response and apologies for not being able to get back yesterday.No problem :) .
    >
    - What i am doing and how - it is the backend database r our Finance application, many users with various transactions.Okay , that sounds like a "normal" database with normal workload.
    - configuring buffer cache size - I haven't done anything manually yet, it's all been as installed, this is what I'm trying to figure out whether it is something I should be looking into doing simply because of the dropping hit ratio and not because of any reported performance problem.If you don't have much of the knowledge, its the best to take use of the advisories which would tell you in a better and in a graphical way that whether you should or shouldn't be worries. Look at the view v$db_cache_advice which can suggest to you that whether you would need to tweak the buffer cache or not.
    >
    - looking at the queries - What is the easiest way of doing this in an environment where many users are running different queries? What's the easiest way to identify queries that we may need to have a closer look at?Easiest way? Well, let the users come back to you ;-) .
    >
    - Basically, I'm just trying to ascertain whether or not I need to be concerned that my hit ratio drops below 89% even though no performance problem has been reported. If it is something that I should look into, then what is the best way to go about it?
    I believe that's answered by couple of us already, nope.
    Aman....

  • Data Buffer Cache Quality

    Hi All,
    Can somebody please please tell some ways in which i can improve the data buffer quality? Presently it is 51.2%. The DB is 10.2.0.2.0
    I want to know, wat all factors do i need to keep in mind if i want to increase DB_CACHE_SIZE?
    Also, i want to know how can i find out Cache Hit ratio?
    Further, i want to know which are the most frequently accessed objects in my DB?
    Thanks and Regards,
    Nick.

    Nick-- wud b DBA wrote:
    Hi Aman,
    Thanks. Can u please give the appropriate query for that?
    And moreover when i'm giving:
    SQL>desc V$SEGMENT-STATISTICS; It is giving the following error:
    SP2-0565: Illegal identifier.
    Regards,
    Nick.LOL dude I put it by mistake. Its dash(-) sign but we need underscore(_) sign.
    About the query, it may vary what you really mean by "most used obect". If you mean to find the object that is undergoing lots of reads,writes than this may help,
    SELECT Rownum AS Rank,
    Seg_Lio.*
    FROM (SELECT St.Owner,
    St.Obj#,
    St.Object_Type,
    St.Object_Name,
    St.VALUE,
    'LIO' AS Unit
    FROM V$segment_Statistics St
    WHERE St.Statistic_Name = 'logical reads'
    ORDER BY St.VALUE DESC) Seg_Lio
    WHERE Rownum <= 10
    UNION ALL
    SELECT Rownum AS Rank,
    Seq_Pio_r.*
    FROM (SELECT St.Owner,
    St.Obj#,
    St.Object_Type,
    St.Object_Name,
    St.VALUE,
    'PIO Reads' AS Unit
    FROM V$segment_Statistics St
    WHERE St.Statistic_Name = 'physical reads'
    ORDER BY St.VALUE DESC) Seq_Pio_r
    WHERE Rownum <= 10
    UNION ALL
    SELECT Rownum AS Rank,
    Seq_Pio_w.*
    FROM (SELECT St.Owner,
    St.Obj#,
    St.Object_Type,
    St.Object_Name,
    St.VALUE,
    'PIO Writes' AS Unit
    FROM V$segment_Statistics St
    WHERE St.Statistic_Name = 'physical writes'
    ORDER BY St.VALUE DESC) Seq_Pio_w
    WHERE Rownum <= 10; But if you are looking for the objects which are most highly in the waits than this query may help
    select * from
       select
          DECODE
          (GROUPING(a.object_name), 1, 'All Objects', a.object_name)
       AS "Object",
    sum(case when
       a.statistic_name = 'ITL waits'
    then
       a.value else null end) "ITL Waits",
    sum(case when
       a.statistic_name = 'buffer busy waits'
    then
       a.value else null end) "Buffer Busy Waits",
    sum(case when
       a.statistic_name = 'row lock waits'
    then
       a.value else null end) "Row Lock Waits",
    sum(case when
       a.statistic_name = 'physical reads'
    then
       a.value else null end) "Physical Reads",
    sum(case when
       a.statistic_name = 'logical reads'
    then
       a.value else null end) "Logical Reads"
    from
       v$segment_statistics a
    where
       a.owner like upper('&owner')
    group by
       rollup(a.object_name)) b
    where (b."ITL Waits">0 or b."Buffer Busy Waits">0)This query's reference:http://www.dba-oracle.com/t_object_wait_v_segment_statistics.htm
    So it would depend upon that on what ground you want to get the objects.
    About the cache increase, are you seeing any wait events related to buffer cache or DBWR in the statspack report?
    HTH
    Aman....

  • Selectively flushing BUFFER CACHE

    We use SQL EXPRESS 2008; so we are limited to 1GB memory. The following query, lists the top databases using highest buffer cache. In my case, 2 insignificant databases are listed at the top. The critical database is number 3--and it performs slow. I don't
    mind the other 2 performing slow. They run a process twice a day, and do nothing. This heavy process blows-up the buffer cache. Is there a way to selectively flush the buffer cache?  (I'm already using 
     DBCC FREESYSTEMCACHE('SQL Plans') 
     DBCC FLUSHPROCINDB ()
    But they were NOT much useful. 
    SELECT db_name(database_id) as dbname,
           count(page_id)  as pages,
       convert(decimal(20,2),count(page_id)*8192.0/1048576) as Mb
    from sys.dm_os_buffer_descriptors
    group by database_id
    order by convert(decimal(20,2),count(page_id)*8192.0/1048576) desc

    Sorry, I have to comment as I also have 1200+ stores with express edition (2005 though :sad face:)
    What's interesting is that the data is staying in cache. If the data isn't being used it'll eventually get aged out as all other have said. I would start by investigating what is using that outside of the one to two processes you've already stated you're
    running. Possibly by tuning or shutting those down (the ones that maybe aren't supposed to run after those processes) you could alleviate this issue.
    The next is to have the developers (if possible) go back and tune their queries. This is extremely important on express edition as a select * from huge table will effectively remove all over data in the buffer pool.
    One alternative that I dare even mention would be that since you can't selectively flush the buffer pool you can offline and then online a database. When this happens all data will be flushed to disk and all entries from the buffer pool and plan cache removed. 
    This is extremely heavy handed and honestly if this fixes you're issue I would look at my first point of seeing what queries are running that NEED that data, since as you've said it isn't needed.
    Other have stated indexes which I will reiterate, but honestly with some of the terrible queries in the retail world it's a moot point.
    Keep us updated - I know you're pain.
    Sean Gallardy | Blog |
    Twitter

  • How to remove an object from Buffer Cache

    Hi,
    I have a simple question. How can I remove an object from the Buffer Cache in Oracle 10gR2 ?
    I am doing some tuning tasks in a shared development database, so I can't do "alter system flush shared_pool" because it will affect other people who are running their queries. So I want to remove from Buffer Cache only the objects that I know that I am the only reader. I can see the objects that I want to be removed by querying the V$BH view.
    By the way, I did some "alter system flush shared_pool" and my objects were not removed from the Buffer Cache, and they are not in the "Keep".
    Thanks In Advance,
    Christiano

    Further more, you can use CACHE | NOCACHE on table level to indicate how you want Oracle handle the data blocks of said table.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2215507
    CACHE | NOCACHE | CACHE READS
    Use the CACHE clauses to indicate how Oracle Database should store blocks in the buffer cache. If you specify neither CACHE nor NOCACHE, then:
    In a CREATE TABLE statement, NOCACHE is the default
    In an ALTER TABLE statement, the existing value is not changed.
    CACHE For data that is accessed frequently, this clause indicates that the blocks retrieved for this table are placed at the most recently used end of the least recently used (LRU) list in the buffer cache when a full table scan is performed. This attribute is useful for small lookup tables.
    As a parameter in the LOB_storage_clause, CACHE specifies that the database places LOB data values in the buffer cache for faster access.
    Restriction on CACHE You cannot specify CACHE for an index-organized table. However, index-organized tables implicitly provide CACHE behavior.
    NOCACHE For data that is not accessed frequently, this clause indicates that the blocks retrieved for this table are placed at the least recently used end of the LRU list in the buffer cache when a full table scan is performed. NOCACHE is the default for LOB storage.
    As a parameter in the LOB_storage_clause, NOCACHE specifies that the LOB value either is not brought into the buffer cache or is brought into the buffer cache and placed at the least recently used end of the LRU list. The latter is the default behavior.
    Restriction on NOCACHE You cannot specify NOCACHE for an index-organized table.
    CACHE READS CACHE READS applies only to LOB storage. It specifies that LOB values are brought into the buffer cache only during read operations but not during write operations.

  • 10G NEW FEATURE-HOW TO FLUSH THE BUFFER CACHE

    제품 : ORACLE SERVER
    작성날짜 : 2004-05-25
    10G NEW FEATURE-HOW TO FLUSH THE BUFFER CACHE
    ===============================================
    PURPOSE
    이 자료는 Oracle 10g new feature 로 manual 하게
    buffer cache 를 flush 할 수 있는 기능에 대하여 알아보도록 한다.
    Explanation
    Oracle 10g 에서 new feature 로 소개된 내용으로 SGA 내 buffer cache 의
    모든 data 를 command 수행으로 clear 할 수 있다.
    이 작업을 위해서는 "alter system" privileges 가 있어야 한다.
    Buffer cache flush 를 위한 command 는 다음과 같다.
    주의) 이 작업은 database performance 에 영향을 줄 수 있으므로 주의하여 사용하여야 한다.
    SQL > alter system flush buffer_cache;
    Example
    x$bh 를 query 하여 buffer cache 내 존재하는 정보를 확인한다.
    x$bh view 는 buffer cache headers 정보를 확인할 수 있는 view 이다.
    우선 test 로 table 을 생성하고 insert 를 수행하고
    x$bh 에서 barfil column(Relative file number of block) 과 file# 를 조회한다.
    1) Test table 생성
    SQL> Create table Test_buffer (a number)
    2 tablespace USERS;
    Table created.
    2) Test table 에 insert
    SQL> begin
    2 for i in 1..1000
    3 loop
    4 insert into test_buffer values (i);
    5 end loop;
    6 commit;
    7 end;
    8 /
    PL/SQL procedure successfully completed.
    3) Object_id 확인
    SQL> select OBJECT_id from dba_objects
    2 where object_name='TEST_BUFFER';
    OBJECT_ID
    42817
    4) x$bh 에서 buffer cache 내에 올라와 있는 DBARFIL(file number of block) 를 조회한다.
    SQL> select ts#,file#,dbarfil,dbablk,class,state,mode_held,obj
    2 from x$bh where obj= 42817;
    TS# FILE# DBARFIL DBABLK CLASS STATE MODE_HELD J
    9 23 23 1297 8 1 0 7
    9 23 23 1298 9 1 0 7
    9 23 23 1299 4 1 0 7
    9 23 23 1300 1 1 0 7
    9 23 23 1301 1 1 0 7
    9 23 23 1302 1 1 0 7
    9 23 23 1303 1 1 0 7
    9 23 23 1304 1 1 0 7
    8 rows selected.
    5) 다음과 같이 buffer cache 를 flush 하고 위 query 를 재수행한다.
    SQL > alter system flush buffer_cache ;
    SQL> select ts#,file#,dbarfil,dbablk,class,state,mode_held,obj
    2 from x$bh where obj= 42817;
    6) x$bh 에서 state column 이 0 인지 확인한다.
    0 은 free buffer 를 의미한다. flush 이후에 state 가 0 인지 확인함으로써
    flushing 이 command 를 통해 manual 하게 수행되었음을 확인할 수 있다.
    Reference Documents
    <NOTE. 251326.1>

    I am also having the same issue. Can this be addressed or does BEA provide 'almost'
    working code for the bargin price of $80k/cpu?
    "Prashanth " <[email protected]> wrote:
    >
    Hi ALL,
    I am using wl:cache tag for caching purpose. My reqmnt is such that I
    have to
    flush the cache based on user activity.
    I have tried all the combinations, but could not achieve the desired
    result.
    Can somebody guide me on how can we flush the cache??
    TIA, Prashanth Bhat.

  • Find available space in buffer cache

    Hi.
    I want to find available space from buffer cache. First thought was to make it 8i-9i comp, by not using v$bh to calculate sum of memory and available space.
    I have the following pl/sql block to calculate the values:
    declare
    num_free_blck integer;
    num_all_blck integer;
    num_used_blck integer;
    overal_cache number := 0;
    used_cache number := 0;
    free_cache number := 0;
    blck_size integer;
    pct_free number := 0;
    begin
    select count(1) into num_free_blck from v$bh where status='free';
    select count(1) into num_all_blck from v$bh;
    select count(1) into num_used_blck from v$bh where status <> 'free';
    select value into blck_size from v$parameter where name ='db_block_size';
    used_cache := (blck_size * num_used_blck)/(1024*1024);
    free_cache := (blck_size * num_free_blck)/(1024*1024);
    overal_cache := (blck_size * num_all_blck)/(1024*1024);
    pct_free := ((free_cache/overal_cache)*100);
    dbms_output.put_line('There are '||num_free_blck||' free blocks in buffer cache');
    dbms_output.put_line('There are '||num_used_blck||' used block in buffer cache');
    dbms_output.put_line('There are totally '||num_all_blck||' blocks in buffer cache');
    dbms_output.put_line('Overall cache size is '||to_char(overal_cache,'999.9')|| 'mb');
    dbms_output.put_line('Used cache is '||to_char(used_cache,'999.9')||' mb');
    dbms_output.put_line('Free cache is '||to_char(free_cache,'999.9')||' mb');
    dbms_output.put_line('Percent free db_cache is '||to_char(pct_free,'99.9')||' %');
    end;
    The result of the execution is:
    SQL> @c:\temp\bh
    There are 3819 free blocks in buffer cache
    There are 4189 used block in buffer cache
    There are totally 8008 blocks in buffer cache
    Overall cache size is 62.6mb
    Used cache is 32.7 mb
    Free cache is 29.8 mb
    Percent free db_cache is 47.7 %
    PL/SQL-prosedyren ble fullført.
    SQL>
    This is not correct according to the actuall size of the buffer cache:
    SQL> select name,value from v$parameter where name='db_cache_size';
    NAME
    VALUE
    db_cache_size
    67108864
    SQL>
    Anyone that have an idea bout this?
    Thanks
    Kjell Ove

    Mark D Powell wrote:
    select decode(state,0,'Free',
    1,'Read and Modified',
    2,'Read and Not Modified',
    3,'Currently being Modified',
    'Other'
    ) buffer_state,
    count(*)  buffer_count
    from    sys.xx_bh
    group by decode(state,0,'Free',
    1,'Read and Modified',
    2,'Read and Not Modified',
    3,'Currently being Modified',
    'Other'
    Provided the OP figures out that xx_bh is probably a view defined by sys on top of x$bh this will get him the number of free buffers - which may be what he wants - but apart from that your query is at least 10 years short of complete, and the decode() of state 3 is definitley wrong.
    The decode of x$bh.state for 10g is:
         decode(state,
              0,'free',
              1,'xcur',
              2,'scur',
              3,'cr',
              4,'read',
              5,'mrec',
              6,'irec',
              7,'write',
              8,'pi',
              9,'memory',
              10,'mwrite',
              11,'donated'
         ), and for 11g it is:
         decode(state,
               0, 'free',
               1, 'xcur',
               2, 'scur',
               3, 'cr',
               4, 'read',
               5, 'mrec',
               6, 'irec',
               7, 'write',
               8, 'pi',
               9, 'memory',
              10, 'mwrite',
              11, 'donated',
              12, 'protected', 
              13, 'securefile',
              14, 'siop',
              15, 'recckpt',
              16, 'flashfree', 
              17, 'flashcur',
              18, 'flashna'
         ), (At least, that was the last time I looked - they may have changed again in 10.2.0.5 and 11.2.0.2)
    Regards
    Jonathan Lewis

  • Will Oracle look into the database buffer cache in this scenario?

    hi guys,
    say I have a table with a million rows, there are no indexes on it, and I did a
    select * from t where t.id=522,000.
    About 5 minutes later (while that particular (call it blockA) block is still in the database buffer cache) I do a
    select * from t where t.id >400,000 and t.id < 600,000
    Would Oracle still pick blockA up from the database buffer cache? if so, how? How would it know that that block is part of our query?
    thanks

    Without an Index, Oracle would have done a FullTableScan on the first query. The blocks would be very quickly aged out of the buffer cache as they have been retrieved for an FTS on a large table. It is unlikely that block 'A' would be in the buffer_cache after 5minutes.
    However, assuming that block 'A' is still in the buffer_cache, how does Oracle know that records for the second query are in block 'A' ? It doesn't. Oracle will attempt another FullTableScan for the second query -- even if, as in the first query -- the resultset returned is only 1 row.
    Now, if the table were indexed and rows were being retrieved via the Index, Oracle would use the ROWID to get the "DBA" (DataBlockAddress) and get the hash value of that DBA to identify the 'cache buffers chain' where the block is likely to be found. Oracle will make a read request if the block is not present in the expected location.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Is dictionary cache double buffered (shared pool, buffer cache)

    Hi,
    I'm trying to get idea about how dictionary cache is buffered .
    Let us say we're talking about dc_objects .
    It is dba_tables view related so all underlying sys.obj$ sys.user$ ... tables block are cached in buffer cache.
    So why we are caching them in dictionary cache space in shared pool additionally ?
    Looks like double buffering and wasting SGA .
    Please explain .
    Regards
    GregG

    HI,
    Dictionary cache will not cache data of tables, rather it will cache the structural information of table (in your case).
    If i will do "select ename from emp", during statement compilation, it needs to check whether "ename" is a real column? and for this it needs to query data dictionary information (from using physical read of system data file or from data dictionary cache if information is there). It also need to check whether i have (logged in user) rights to access this table/column and all this information comes from data dictionary.
    This is a simple example, otherwise dictionary cache need to store a lot of other information also (but purely the information present in data dictionary)
    Salman

  • How to remove blocks from buffer cache for a specific object

    hi everybody,
    is it possible to remove blocks which belogns to a specific object (a table for ex) from buffer cache.
    as you know, there is
    alter system flush buffer_cache;command but it does it's job for all buffer cache. if you ask me why i want this, for tuning reasons. I want to test some plsql codes when they run as if they are running for the first time (reading from disk).
    ps: I use oracle 11g r2

    Hi mustafa,
    Your performance will not degrade if you run the query second time ( if i understood correctly, you worry about the performance if you execute the procedure second time). Executing/running the code/sql statements over and over again will have following two good benefits.
    1) This will avoid hard parsing (Hard parsing is resource intensive operation and this generally increase the overall processing time.
    2) This will avoid physical read IO (You gonna see the benefits if data blocks already cached and you dont have to spend time in reading blocks from disk. Reading from disk is much costlier and time consuming operation as compared to data in RAM)
    Having that said sometime bad written queries will acquire more blocks then required and consume most part of buffer cache, and this can some times effect the other important blocks and force to flush out from buffer cache.
    Oracle have built some intelligence for large full table scan operations for e.g will doing full table scan(I hope you already know what is fts) oracle will put its blocks at end of LRU chain. So these will be the buffers will would flush out first then any other.
    From oracle documentation:
    "When the user process is performing a full table scan, it reads the blocks of the table into buffers and puts them on the LRU end (instead of the MRU end) of the LRU list. This is because a fully scanned table usually is needed only briefly, so the blocks should be moved out quickly to leave more frequently used blocks in the cache.
    You can control this default behavior of blocks involved in table scans on a table-by-table basis. To specify that blocks of the table are to be placed at the MRU end of the list during a full table scan, use the CACHE clause when creating or altering a table or cluster. You can specify this behavior for small lookup tables or large static historical tables to avoid I/O on subsequent accesses of the table."
    Regards
    Edited by: 909592 on Feb 6, 2012 4:37 PM

  • Unused tables in the buffer cache

    I have a program that queries the V$BH view every hour and stores the name of every table in the buffer cache. There is a set of tables that are never used which are appearing in the buffer cache every hour. I did a case insensitive search of the V$SQL and V$SQLTEXT views for these table names, but found nothing. How can tables be put in the buffer cache if there is no SQL statement refering to them? I'd like to find the session and program which is using these tables that no one is supposed to be using.
    Kevin Tyson

    This can be due to recursive SQL. Means the SQL not fired directly by the app but fired by oracle to satistfy some requirment. It can be related to some system tables or other users tables.
    Example of system tables:
    Oracle use system tables to reflect the current state of the database like when you insert records it update the extent information and when you create the object it update the data dictionary so that object reflect in that etc etc etc
    Example of users tables:
    you fired an insert statement to insert one record in table emp but to insert that record oracle has to check the state of foreign key data by querying dept and other tables so enev if you didn't specify dept table oracle use it internally to check the integrity constraint.
    Daljit Singh

Maybe you are looking for