Finding used space in Oracle Cache

Is there any way to find the size of the buffer cache used to perform a particular query. I want it in exact bytes/blocks. I doesnot mean the maximum buffer cache, but the used buffer cache?

Hi;
What is db version?
please see below thread which could you give some hint to you
buffer cache usage
Buffer Cache Usage
Regard
Helios

Similar Messages

  • 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

  • How to find memory taken by Oracle processes using top command

    I wanted to know how to find the memory taken by Oracle processes using top command. The output of the top command is as follows as an example:
    Mem: 16436072k total, 16215708k used, 220364k free, 395128k buffers
    Swap: 25165816k total, 1168288k used, 23997528k free, 13366520k cached
    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    27281 oraprod 15 0 6705m 1.3g 1.3g S 0.0 8.6 61:44.71 oracle
    27383 oraprod 15 0 6702m 1.2g 1.2g S 0.0 7.7 2:22.75 oracle
    5199 oraprod 16 0 6745m 1.1g 1.0g S 0.0 6.8 2:51.23 oracle
    The different Oracle processes could be Oracle database, Oracle listener, Oracle enterprise manager etc.
    I hope, my question is clear as to how to find the memory taken by a process using top command.
    Please revert with the reply to my query.
    Regards

    a short and correct answer would be: you can't.
    As oracle uses a fair amount of shared memory, and that shared memory is attached to most of the oracle processes, the same memory appears a number of times.
    you should rephrase your question / what is it you want to achieve?
    you can ask oracle how much memory is assigned to it, v$sga, v$sgastat, v$process (for PGA). moreover, you as DBA are the one who configured that.
    you can look at major an minor faults per process to see what is causing the paging (if you have any).
    you can also look at the /proc/pid/statm pseudofilesystem for your oracle pids.

  • Find the used space in datafile on any specific date

    Hi,
    We have a datafile created on 2-11-2009.
    I wish to find the used space in that datafile on 13-12-2009.
    From v$datafile and dba_data_files from the "BYTES" column it wld give me the current used space in the datafile.
    But how to find the used space in datafile on any specific date.
    Thanks.

    Hello,
    It depends on your Oracle release, starting with Oracle 10.1, you have the View dba_hist_tpspc_space_usage which may give you an history of the space used by the Tablespaces:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_3195.htm#I1023456
    You may have to pay for specific license to be allowed to access to this View which belongs to AWR (Automatic Workload Repository).
    Hope this help.
    Best regards,
    Jean-Valentin

  • How to find out the used space and free space in the DB for attachments

    Hi,
    In CRM 5.2 web UI, we can save a transaction by saving attachments like work documents or text files.
    Could someone help me find out the used space, free space, maximum capacity on the CRM DB for these attachments.
    Thanks & Best Regards,
    Ramesh.

    Hi,
    check with  below table
    TNAPR   ---  Processing programs for output
    and NACE Transaction code
    NACE  --  out types
    Regards,
    Madhu

  • How to find out the Non Partitioned Tables used 2Gb on oracle

    Hi team
    how to find out the Non Partitioned Tables used > 2Gb on oracle where not is sys & system
    regards

    heres 1 I made earlier
    set pagesize 999
    set linesize 132
    col owner format a25
    col segment_name format a60
    select owner,segment_name,segment_type,(bytes/1024/1024)"MB size"
    from dba_segments
    where owner not in ('SYS','SYSTEM','XDB','MDSYS','SYSMAN') -- edit for taste
    and segment_type = 'TABLE'
    having (bytes/1024/1024) > 2000
    group by bytes, segment_Type, segment_name, owner
    order by 4 asc

  • Finding the size of db and size of used space

    Greetings all good people.
    Can you please help me find out about 2 database information?
    One, I want to find out the size of a database =size of physical files.
    and the size of data which is the size occupied in physical files.
    We are about to start a new project and there is a table on the database but it is empty.
    We want to be exporting data into this table but we want to make sure that there is enough space on the db before we start populating the table with data.
    I believe the code below just gives me the size of the database.
    select (bytes/1024/1024) as total_gigs from dba_segments where owner='BELL' and segment_name='$TABLE_NAME
    But I want to know the total size of the database and how much size has been used already, much the same as you would want to know the size capacity of a hard drive and how much of the size has been used.
    Sorry if my request is confusing.
    Thanks a lot in advance

    db size can be found out
    select sum(bytes)/1024/1024/1024 from dba_data_files ;
    and size of data is -- in the datafiles
    select sum(bytes)/1024/1024/1024 from dba_segemnts ;
    You can find out by below query .. the tablespace sizes -- would be DBSIZE
    used space -- would be the actual occupied space.
    select t.tablespace, t.totalspace as " Totalspace(MB)",
    round((t.totalspace-nvl(fs.freespace,0)),2) as "Used Space(MB)",
    nvl(fs.freespace,0) as "Freespace(MB)"
    from
    (select round(sum(d.bytes)/(1024*1024)) as totalspace,d.tablespace_name tablespace
    from dba_data_files d
    group by d.tablespace_name) t, (select round(sum(f.bytes)/(1024*1024)) as freespace,f.tablespace_name tablespace
    from dba_free_space f
    group by f.tablespace_name) fs
    where t.tablespace=fs.tablespace (+)
    order by t.tablespace

  • Issue while finding disk space using df -k . , df -g . & statvfs API

    Hi,
    To find disk space:
    If I use df -k . command to find available space, it gives
    6927549 available space
    Where as if I use df -g . command it gives
    13855098 avaliable space which is exactly double of above (6927549 * 2) available space.
    Also, I have used statvfs API to get free disk space and it is giving as,
    f_bavail= 6927493 ----- which is equivalent to df -k . command's disk space.
    f_bsize = 8192
    f_frsize= 1024
    f_blocks= 140918146
    f_bfree= 8336674
    f_files= 16959488
    f_ffree= 16325903
    f_fsid= 8388630
    f_basetype= ufs
    f_flag= 4
    f_namemax= 255
    So, my question is why it is getting doubled when I use df -g for current file system?

    Because df -g reports in 512 bytes blocks not in Kilobytes.
    You'll notice the man page says that specifying the -g option overrides the -k (report in Kb) option.
    Unfortunately for historical reasons all the internal interfaces like statvfs report things in blocks.

  • To find out " dot" using substr in oracle

    Hi ,
    I would like to find "Dot" between Schemaname and table name using substring in Oracle . I am using oracle 9i.I can't use Regexp in Oracle 9i
    Schemaname .tablename
    Table name can be any no of characters
    Schema name also can be any no of characters
    Regards,
    User

    Are you looking for this?
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>
    satyaki>declare
      2    str  varchar2(30);
      3    ctr  varchar2(30);
      4  begin
      5    str := 'SCOTT.EMP';
      6   
      7    ctr := 'SCOTT';
      8   
      9    if ctr = substr(str,1,instr(str,'.')) then
    10        dbms_output.put_line('User Matches....');
    11    else
    12      dbms_output.put_line('User Does Not Matches....');
    13    end if;
    14  end;
    15  /
    User Does Not Matches....
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>declare
      2    str  varchar2(30);
      3    ctr  varchar2(30);
      4  begin
      5    str := 'SCOTT.EMP';
      6   
      7    ctr := 'SCOTT';
      8   
      9    if ctr = substr(str,1,instr(str,'.')-1) then
    10        dbms_output.put_line('User Matches....');
    11    else
    12      dbms_output.put_line('User Does Not Matches....');
    13    end if;
    14  end;
    15  /
    User Matches....
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    satyaki>Regards.
    Satyaki De.

  • Where to find and how to use JDAPI with oracle forms

    Hi All
    I want to use JDAPI for oracle forms, plz can any one suggest that where i can find the required jar for JDAPI, provide me if any links r there for downloading JDAPI.
    Thanks in Advance

    Hi Torsten Kleiber
    I am interested in changing forms buttons in our existing forms .I was trying to find if it was possible.Going thru your post I realised it is possible to change properties in existing forms .
    i have specific questions with JDAPI will i be able to change my buttons in a form to Iconic buttons.
    Could you kindly send me the code of your class in the abovementioned post (I have created a simple class to modify some forms properties.)
    I would like to have alook at it i am a Novice in java but looking at your source code may be able to give myself a head start .(I am well versed pl/sql forms and reports NO JAVA idea)
    Two while trying out the oracle demo to create a form by jdapi I was able to create a class and was unable to execute it .What do i need to install to execute it. I have forms 10 installtion with Jinitiator 1.3 installed
    DO i need to install Jdeveloper or JDK i think either of this is required. I shall be highly be obliged if u can clear my queries or any one else in the forum may wish to add to 2cents to my infinetly minimal knowledge of java

  • Caching at client end using Oracle Cache Implementation

    I would like to know if we could use Oracle' Cache Implementation at the client end [Application server]- if so how do I go abt it & from performance point of view is this better .... Pls get back at the earliest

    Dear All,
    I got this link while googling -
    http://www.ibm.com/developerworks/webservices/library/ws-cach1/
    ................ caching concept is clear now............ but still
    implementation part is not cleared.....
    How, What and Where i need to do changes for this............
    I am using JDK 1.5 and Axis 1.4........
    Regards,
    Santosh Sharma

  • HT2490 Mac OS X 10.6.8 - Finder Preview of Quicktimes using Space Bar

    I work with a lot of preview Quicktimes and for some reason all the files with a 320X240 aspect ratio are previewing (using space bar) with the wrong frame size (long skinny picture).  Any other files with a different frame size are displaying normal.

    Please refer to this:
    http://support.apple.com/kb/HT3876
    Ciao.

  • Step 6 error insufficient disk space in oracle linux

    hi am in step 6 installing my oracle oracle in oracle Linux am getting insufficient disk space on this volume for the selected oracle
    i have this dir oracle_base = /u01/app/oracle/product
    sofware location /u01/app/oracle/product/11.2.0/db_1
    database file location /u01/app/oracle/product/oradata
    how can i check space becuase is have enough space
    Edited by: Tshifhiwa on 2012/01/27 2:40 PM
    i type free -m
    total used free shared buffers cached
    Mem: 1988 1844 143 0 36 1365
    -/+ buffers/cache: 443 1545
    Swap: 3999 0 3999
    Edited by: Tshifhiwa on 2012/01/27 2:40 PM
    Edited by: Tshifhiwa on 2012/01/27 3:44 PM
    Edited by: Tshifhiwa on 2012/01/27 4:05 PM

    Tshifhiwa wrote:
    hi am in step 6 installing my oracle oracle in oracle Linux am getting insufficient disk space on this volume for the selected oracle
    i have this dir oracle_base = /u01/app/oracle/product
    sofware location /u01/app/oracle/product/11.2.0/db_1
    database file location /u01/app/oracle/product/oradata
    how can i check space becuase is have enough space
    Edited by: Tshifhiwa on 2012/01/27 2:40 PM
    i type free -m
    total used free shared buffers cached
    Mem: 1988 1844 143 0 36 1365
    -/+ buffers/cache: 443 1545
    Swap: 3999 0 3999
    Edited by: Tshifhiwa on 2012/01/27 2:40 PM
    Edited by: Tshifhiwa on 2012/01/27 3:44 PM
    Edited by: Tshifhiwa on 2012/01/27 4:05 PM<Sigh!>
    http://lmgtfy.com/?q=check+disk+space+in+linux

  • Monitoring Used (%) space for tablespaces

    Hi everyone,
    I am currently using:
    Redhat Linux ES 5 2.6.18 and also
    Oracle 10g Release 2 for Linux x86 R10.2.0.3
    While monitoring my Tablespaces using OEM Database Control, I notice that two tablespaces were almost full.
    [SYSAUX] - Size: 290MB , Used 283MB (97% full)
    [SYSTEM] - Size: 320MB, Used 313MB (98% full)
    When I try to locate the datafiles of both tablespaces in its directory (/home/dba/oracle/oradata/oracle), it shows the allocated size (290MB for sysaux01.dbf & 320MB for system01.dbf) and not the used space.
    I got three questions to ask over here:
    1st- Why there isn't any warnings or alarms even though the tablespaces exceeds the critical size?
    2nd- How come the datafiles shows the allocated size of the tablespaces and not the Used space?]
    3rd- How can I find & monitor the actual used space of the tablespaces?
    4th- I have enabled the AutoExtend function but I am worry whether is there any other concern?
    I am still very new here.
    Please pardon me for anything that is improper.
    Looking forward for your expertise, guidance & help.
    Thanks for your attention.
    -Regards-
    ++ Kef Lim ++

    Hi,
    Here you have some scripts:
    TABLESPACE USAGE NOTES:
    Tablespace Name - Name of the tablespace
    Bytes Used - Size of the file in bytes
    Bytes Free - Size of free space in bytes
    Largest - Largest free space in bytes
    Percent Used - Percentage of tablespace that is being used - Careful if it is more than 85%
    select     a.TABLESPACE_NAME,
         a.BYTES bytes_used,
         b.BYTES bytes_free,
         b.largest,
         round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used
    from      
              select      TABLESPACE_NAME,
                   sum(BYTES) BYTES
              from      dba_data_files
              group      by TABLESPACE_NAME
         a,
              select      TABLESPACE_NAME,
                   sum(BYTES) BYTES ,
                   max(BYTES) largest
              from      dba_free_space
              group      by TABLESPACE_NAME
         b
    where      a.TABLESPACE_NAME=b.TABLESPACE_NAME
    order      by ((a.BYTES-b.BYTES)/a.BYTES) desc
    SET SERVEROUTPUT ON
    SET PAGESIZE 1000
    SET LINESIZE 255
    SET FEEDBACK OFF
    PROMPT
    PROMPT Tablespaces nearing 0% free
    PROMPT ***************************
    SELECT a.tablespace_name,
           b.size_kb,
           a.free_kb,
           Trunc((a.free_kb/b.size_kb) * 100) "FREE_%"
    FROM   (SELECT tablespace_name,
                   Trunc(Sum(bytes)/1024) free_kb
            FROM   dba_free_space
            GROUP BY tablespace_name) a,
           (SELECT tablespace_name,
                   Trunc(Sum(bytes)/1024) size_kb
            FROM   dba_data_files
            GROUP BY tablespace_name) b
    WHERE  a.tablespace_name = b.tablespace_name
    AND    Round((a.free_kb/b.size_kb) * 100,2) < 10
    PROMPT
    SET FEEDBACK ON
    SET PAGESIZE 18
    Set Termout  On
    Set Heading  On
    clear breaks
    break on contents -
    skip 1
    compute Sum of alloc used free nbfrag on contents
    column tblsp         format a20 wrap          heading  "Tablespace Name"
    column Alloc         format 999,999           heading  "Alloc|(Mb)"
    column Free          format 999,999           heading  "Free|(Mb)"
    column used          format 999,999           heading  "Used|(Mb)"
    column pused         format 990.9             heading  "%|Used|Space"
    column fragmax       format 99,999.9          heading  "Largest|Free|Ext.(Mb)"
    column nbfrag        format 99999             heading  "Nb|frag"
    column contents      format a10               heading  "Content"
    column pct_ext_coal  format 999                     heading  "% Ext.|Coal."
    column ext_manage    format a7 wrap           heading  "Ext.|M."
    column autoext       format a7 wrap           heading  "Auto|Ext."
    select
           contents
         , nvl (dt.tablespace_name, nvl (fsp.tablespace_name, 'Unknown')) tblsp
         , alloc
         , alloc - nvl (free, 0)       Used
         , nvl (free, 0)               Free
         , ((alloc - nvl (free, 0)) / alloc) * 100  pused
         , nbfrag
         , fragmax
         , dfsc.pct_ext_coal pct_ext_coal
         , dt.ext_manage
         , df.inc                           autoext
      from
           ( select sum (bytes)/1048576     free
                  , max (bytes)/1048576     fragmax
                  , tablespace_name
                  , count(*)                nbfrag
              from  sys.dba_free_space
             group  by tablespace_name
           ) fsp
        ,  ( select sum(bytes)/1048576      alloc
                  , tablespace_name
                  , Decode(((inc * &Var_DB_BLOCK_SIZE)/1024), Null, 'No', 'Yes')     inc
               from sys.dba_data_files sddf
                  , sys.filext$        aut
              where sddf.file_id       =  aut.file#   (+)
              group by tablespace_name
                     , Decode(((inc * &Var_DB_BLOCK_SIZE)/1024), Null, 'No', 'Yes')
              Union
              select sum(bytes)/1048576      alloc
                   , tablespace_name
                   , Decode(((increment_by * &Var_DB_BLOCK_SIZE)/1024), Null, 'No', 'Yes')    inc
                from sys.dba_temp_files sddf
               group by tablespace_name
                      , Decode(((increment_by * &Var_DB_BLOCK_SIZE)/1024), Null, 'No', 'Yes')
           ) df
        ,  ( select contents
                  , tablespace_name
                  , initial_extent/1024     initial_ext
                  , next_extent/1024        next_ext
                  , pct_increase
                  , max_extents
                  , min_extents
                  , Substr(extent_management,1,5)       ext_manage
               from dba_tablespaces
           ) dt
         , ( select percent_extents_coalesced    pct_ext_coal
                  , tablespace_name
               from dba_free_space_coalesced
           ) dfsc
    where
           fsp.tablespace_name  (+)   =   dt.tablespace_name
       and
           df.tablespace_name   (+)   =   dt.tablespace_name
       and
           dfsc.tablespace_name (+)   =   dt.tablespace_name
    order
        by contents
         , pused desc
    ;Cheers,
    Francisco Munoz Alvarez
    http://www.oraclenz.com

  • 'Miscellaneous Used Space'

    Since I have the 64gb Macbook Air, disk space is precious to me.
    Recently I have run into a problem, where whenever I delete a large file (over 1gb) Grandperspective sees it as Miscellaneous Used Space
    Most of the things I delete are TV shows I download from itunes, drag them to my external HDD and delete them (always choosing 'delete file' from itunes)
    I recently had it with a game I downloaded from the app store.
    Before i used to make a backup, download the show, drag it to my external HDD and restore my computer from Time Machine, but that took too long.
    When I 'get info' on my SSD there is 41.16gb free out of 59.81
    But on Grandperspective, there is only 36.4gb free, 3gb miscellaneous used space and 16.2gb free space
    How can I get rid of the miscellaneous used??
    And stop is from appearing in the future??

    Ditto.....
    My disk (1Tb) has about 150Gb of actual data on it.
    Finder reporting 802 GB used. Various program, Whatsize, Grandperspective etc all reporting "650 Gb of Miscellaneous used Space. Used Cache Cleaner, no difference.
    Been working on it for days, cannot find any rogue files to delete.
    Apple support said "reinstall Snow Leopard" ... "make sure you have a back up"
    The reason I don't have a back up is Time Machine (and another 3rd Party BU solution) wont work because it cant back up the HDD because it is too big!!
    Any help would be much appreciated.

Maybe you are looking for