Free space in temp tablespace

SQL> show parameter block
NAME                                 TYPE        VALUE
db_block_buffers                     integer     0
db_block_checking                    boolean     FALSE
db_block_checksum                    boolean     TRUE
db_block_size                        integer     8192
db_file_multiblock_read_count        integer     8
SQL> SELECT tablespace_name,
       total_blocks,
       used_blocks,
       free_blocks,
    (total_blocks*8)/1024 as total_MB,
    (used_blocks*8)/1024  as used_MB,
    (free_blocks*8)/1024  as free_MB
FROM   v$sort_segment;
   2    3    4    5    6    7    8 
TABLESPACE_NAME                 TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS   TOTAL_MB    USED_MB    FREE_MB
TEMP                                   72704        2944       69760        568         23        545
SQL>  select (sum(bytes_free)/1024/1024) Size_MB from v$temp_space_header
order by file_id  2 
  3  /
   SIZE_MB
      1479
SQL>
My version is 9.2.0.7
why temp free space is different in both queries above..
which one is correct.....

why temp free space is different in both queries above..Because you are looking at two different values.
V$SORT_SEGMENT gives details about the sort segment created in a temporary tablespace. The sort segment created may or may not be of the same size as the complete temporary tablespace. In your case, the sort segment has a total size of 568 MB but only 23 MB is being used.
V$TEMP_SPACE_HEADER refers to the physical files allocated to the temporary tablespace; so the other query is giving you the free bytes in those files.

Similar Messages

  • How to find free space in a Tablespace?

    Hi,
    I have a limited access to objects in my database ( do not have access to many tables).
    I have been allocated 300GB of size in my tablespace which allows me to create my objects.
    Now, I want to find out how much of this tablespace size allocated to me have been used up. I do not have access to dba_data_files or dba_segments.
    Is there a way out for me? Could anyone show me a way please?

    This query will give you the required information but it makes use of DBA tables.
    SELECT B.TABLESPACE_NAME, TBS_SIZE SIZEGB, A.FREE_SPACE FREEGB
    from  (select tablespace_name, round(sum(bytes)/1024/1024/1024 ,2) as free_space
           from dba_free_space
           GROUP BY TABLESPACE_NAME) A,
          (select tablespace_name, sum(bytes)/1024/1024/1024 as tbs_size
           from dba_data_files
           group by tablespace_name) b
    where a.tablespace_name(+)=b.tablespace_name;
    However, you said that you are aware of your tablespace details so the above query can be modified to get the free space in your tablespace. Now I am using user_frees_space and not dba_free_space. Generally user* tables are and should be made accessible to the users.
    select  tablespace_name, round(sum(bytes)/1024/1024/1024 ,2) as free_space
    from    user_free_space
    where   tablespace_name = 'Your tablespace name'
    GROUP BY TABLESPACE_NAME;
    Ishan

  • Free space in UNDO tablespace

    Hi,
    in DB version 9.2.0, after all transactions are committed, the occupied blocks in UNDO tablespace will be free or not ?
    The same just after startup, before any transaction the free space in UNDO tablespace would be at max ?
    Many thanks.

    Hello Dear copy this script and paste in the sql prompt and it will show your how much total space table have, or how much is used and how much it is free
    SELECT Total.name "Tablespace Name",
    nvl(Free_space, 0) Free_space,
    nvl(total_space-Free_space, 0) Used_space,
    total_space
    FROM
    (select tablespace_name, sum(bytes/1024/1024) Free_Space
    from sys.dba_free_space
    group by tablespace_name
    ) Free,
    (select b.name, sum(bytes/1024/1024) TOTAL_SPACE
    from sys.v_$datafile a, sys.v_$tablespace B
    where a.ts# = b.ts#
    group by b.name
    ) Total
    WHERE Free.Tablespace_name(+) = Total.name
    ORDER BY Total.name

  • To know the amount of free space in a tablespace

    hi,
    I'm learning oracle 9i release 9.2.0.1.0 .I'd created a tablespace 'TOOLS' for being used as the default tablespace for Statspack.
    I wish to know the amount of free space available in this tablespace. For this purpose I ran the following query but there was no rows selected :-
    SQL> select tablespace_name,bytes from dba_free_space
    2 where tablespace_name='TOOLS';
    no rows selected
    SQL> select name from v$tablespace;
    NAME
    CWMLITE
    DRSYS
    EXAMPLE
    INDX
    ODM
    SYSTEM
    TOOLS
    UNDOTBS1
    USERS
    XDB
    TEMP
    Can anyone tell the reason for this.

    I tried your query
    SQL> select TABLESPACE_NAME,
    2 sum(BYTES) Total_free_space,
    3 max(BYTES) largest_free_extent
    4 from dba_free_space
    5 group by TABLESPACE_NAME;
    ♀TABLESPACE_NAME TOTAL_FREE_SPACE LARGEST_FREE_EXTENT
    CWMLITE 11141120 10878976
    DRSYS 10813440 10813440
    EXAMPLE 131072 131072
    INDX 26148864 26148864
    ODM 11206656 11206656
    SYSTEM 3211264 3080192
    UNDOTBS1 199229440 196149248
    USERS 26083328 26083328
    XDB 196608 196608
    9 rows selected.
    Again there were no rows for TOOLS tablespace.

  • Free space in temport tablespaces

    Hi. In my database i have TEMP tablespace with extent management LOCAL.
    In DBA studio it shows total space 8000M and free space 7996
    when i query v$sort_segment
    select substr(TABLESPACE_NAME,1,10) ts_name,EXTENT_SIZE,CURRENT_USERS,
    TOTAL_EXTENTS,TOTAL_BLOCKS,FREE_EXTENTS,FREE_BLOCKS
    from v$sort_segment;
    it shows
    TS_NAME EXTENT_SIZE CURRENT_USERS TOTAL_EXTENTS TOTAL_BLOCKS FREE_EXTENTS
    FREE_BLOCKS
    TEMP 128 0 7996 1023488 7996
    1023488
    where as when i query v$temp_space_header
    select TABLESPACE_NAME,BYTES_USED,BLOCKS_USED,BYTES_FREE,BLOCKS_FREe
    FROM v$temp_space_header;
    TABLESPACE_NAME BYTES_USED BLOCKS_USED BYTES_FREE BLOCKS_FREE
    TEMP 2097152000 256000 0 0
    TEMP 2097152000 256000 0 0
    TEMP 2097152000 256000 0 0
    TEMP 2097152000 256000 0 0
    I have no active queries going on in database.
    i would like to know few things..
    a). why there is a discrepency between free_extents,free_blocks of v$sort_segment
    and bytes_free_blocks_free of v$temp_space_header.
    b). if i shutdown the database and restart will this v$emp_space_header view gets updated and thus shows actual free space.
    please let me have the answers at the earliest.
    thanks in advance..

    Hi. In my database i have TEMP tablespace with extent management LOCAL.
    In DBA studio it shows total space 8000M and free space 7996
    when i query v$sort_segment
    select substr(TABLESPACE_NAME,1,10) ts_name,EXTENT_SIZE,CURRENT_USERS,
    TOTAL_EXTENTS,TOTAL_BLOCKS,FREE_EXTENTS,FREE_BLOCKS
    from v$sort_segment;
    it shows
    TS_NAME EXTENT_SIZE CURRENT_USERS TOTAL_EXTENTS TOTAL_BLOCKS FREE_EXTENTS
    FREE_BLOCKS
    TEMP 128 0 7996 1023488 7996
    1023488
    where as when i query v$temp_space_header
    select TABLESPACE_NAME,BYTES_USED,BLOCKS_USED,BYTES_FREE,BLOCKS_FREe
    FROM v$temp_space_header;
    TABLESPACE_NAME BYTES_USED BLOCKS_USED BYTES_FREE BLOCKS_FREE
    TEMP 2097152000 256000 0 0
    TEMP 2097152000 256000 0 0
    TEMP 2097152000 256000 0 0
    TEMP 2097152000 256000 0 0
    I have no active queries going on in database.
    i would like to know few things..
    a). why there is a discrepency between free_extents,free_blocks of v$sort_segment
    and bytes_free_blocks_free of v$temp_space_header.
    b). if i shutdown the database and restart will this v$emp_space_header view gets updated and thus shows actual free space.
    please let me have the answers at the earliest.
    thanks in advance..

  • Free space available in tablespace

    Hi, Any one help me how to check how much free space available on a particular Tablespace. Appreciate if you provide query.
    Thanks & Regards
    Bhaskara

    This SQL will return free space by datafile in the tablespace.
    SELECT a.name FileName, a.status, c.bytes/1024 CurrentSize, a.create_bytes/1024 SizeCreated,
    sum(b.bytes/1024) FreeSpace, max(b.bytes/1024) LargeFragment
    from sys.v_$datafile a, sys.dba_free_space b, sys.dba_data_files c
    where a.file# = b.file_id(+)
    and a.file#=c.file_id
    and c.tablespace_name='XXXXXXXXXXXXXXXXX'
    group by a.name, a.status, c.bytes, a.create_bytes
    ORDER BY a.name;
    I just posted an integrated set of GUI tools to administer the Oracle database.
    One of the many functions is to view and maintain all database objects including tablespaces and datafiles. It also has a graphical function to monitor space allocation for tablespaces. You may need same help to get started, so feel free to contact me ([email protected]). The link is http://www.barsoft.net/

  • Free block in temp tablespace

    how to find number of free block in temp tablespace

    Couldn't be bothered to mention an Oracle version number, eh?
    Well, if you're on a reasonably modern Oracle version, and you have a "proper" temporary tablespace (i.e. create temporary tablespace ....), then once blocks are allocated, they are never deallocated, they're only marked as available when a session is done using them.
    So, to see how much is currently in use, have a look at V$SORT_SEGMENT.
    -Mark

  • Generating xml using PL/SQL taking a lot of space in TEMP tablespace

    We wrote a stored procedure that generate xml which will be stored in a CLOB column. Environment is 9i on Windows 2003.
    The gnerated xml is about 800K. In the procedure there is one big cursor that will retrieve 200 records of 55 fields and many other small dynamic cursors that open and close here and there. The fields are pretty small. Biggest ones are like varchar2(30). The query for the big cursor does using union and need sorting.
    Can anyone explain why it takes about 15G of TEMP tablespace to accomplish this job and is there a way to avoid this?

    The version is Enterprise Edition 9.2.0.1.0.
    Below is the query.
    SELECT ROWNUM + ( SELECT NVL(MAX(WQX_ACTIVITY_GEN_ID), 0) FROM WQX_ACTIVITY ) as WQX_ACTIVITY_GEN_ID
         , A.ACTIVITYIDENTIFIER2            as ACTIVITY_IDENTIFIER
         , (SELECT MAX(O.ORGANIZATION_NAME) FROM SYS_ORGANIZATION O WHERE O.ORGANIZATION_ID = 111242)  as ORGANIZATION_NAME
         , (SELECT MAX(P.PROJECT_IDENTIFIER) FROM SYS_PROJECT P WHERE P.PROJECT_ID = 111242) as PROJECT_IDENTIFIER
         , A.ACTIVITYTYPECODE               as ACTIVITY_TYPE_CD
         , A.ActivityMediaName              as ACTIVITY_MEDIA_NAME
         , A.ActivityMediaSubDivisionName   as MEDIA_SUB_DIVISION
         , A.ActivityStartDate              as ACTIVITY_START_DATE
         , CASE WHEN A.ActivityStartTime is not NULL THEN
                     substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'
                WHEN A.ActivityStartTime is NULL THEN ''
           END as ACTIVITY_START_TIME
    --   , substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00' as ACTIVITY_START_TIME
         , A.ACTIVITYENDDATE                as ACTIVITY_END_DATE
         , CASE WHEN A.ACTIVITYENDTIME is not NULL THEN
                     substr(A.ACTIVITYENDTIME,1,2)||':'||substr(A.ACTIVITYENDTIME,3,2)||':00'
                WHEN A.ACTIVITYENDTIME is NULL THEN ''
           END as ACTIVITY_END_TIME
    --   , substr(A.ACTIVITYENDTIME,1,2)||':'||substr(A.ACTIVITYENDTIME,3,2)||':00' as ACTIVITY_END_TIME
         , A.TIMEZONECODE1                  as TIME_ZONE_CD
         , A.ActivityRelativeDepthName      as RELATIVE_DEPTH_NAME
         , NULL                             as DEPTH_HEIGHT_MEASURE
         , NULL                             as DEPTH_HEIGHT_UNIT
         , 111242              as MONITORING_LOC_ID
         , A.ACTIVITYCOMMENTTEXT            as COMMENT_
         , A.SamplerName                    as SAMPLER_NAME
         , A.ActivityArea                   as ACTIVITY_AREA
         , A.ReportingRound                 as REPORTING_ROUND
         , A.SamplePanel                    as SAMPLEPANEL
         , A.DataIncludedinReport           as DATA_INCLUDED_IN_REPORT
         , A.FlowStatusIndicator            as FLOW_STATUS_IND
         , A.SampleChainOfCustody           as SAMPLE_COC
         , A.ActivitySeason                 as ACTIVITY_SEASON
         , A.RunoffImpact                   as RUNOFF_IMPACT
         , (111242)            as MONI_LOC_ID
         , (SELECT MAX(B.MONI_LOC_IDENTIFIER) FROM WQX_MONITORING_LOC B WHERE B.MONI_LOC_IDENTIFIER = A.MONITORINGLOCATIONIDENTIFIER) as MONI_LOC_IDENTIFIER
         , 111242                     as PROJECT_ID
         , NULL                             as BIO_ASSEMB_SAMPLED_NAME
         , NULL                             as BIO_TOXICITY_TEST_TYPE
         , A.METHODIDENTIFIER1              as SAMPLE_COLLECT_METHOD_IDENTIFI
         , A.METHODIDENTIFIERCONTEXT1       as SAMPLE_COLLECT_METHOD_CONTEXT
         , A.METHODNAME1                    as SAMPLE_COLLECT_METHOD_NAME
         , NULL                             as SAMPLE_COLLECT_QUALIFIER_TYPE
         , A.METHODDESCRIPTIONTEXT1         as SAMPLE_COLLECT_DESC
         , A.SampleCollectionEquipmentName  as SAMPLE_COLLECT_EQUIP_NAME
         , A.SAMPLECOLLECTIONEQUIPMENTTXT   as SAMPLE_COLLECT_EQUIP_DESC
         , A.METHODNAME2                    as SAMPLE_PREP_METHOD_NAME
         , A.METHODIDENTIFIER2              as SAMPLE_PREP_METHOD_IDENTIFIER
         , A.METHODIDENTIFIERCONTEXT2       as SAMPLE_PREP_METHOD_CONTEXT
         , NULL                             as SAMPLE_PREP_QUALIFIER_TYPE
         , A.METHODDESCRIPTIONTEXT1         as SAMPLE_PREP_DESC
         , A.SampleContainerTypeName        as SAMPLE_CONTAINER_TYPE
         , A.SampleContainerColorName       as SAMPLE_CONTAINER_COLOR
         , A.ChemicalPreservativeUsedName   as CHEM_PRESERVATIVE_USED
         , A.ThermalPreservativeUsedName    as THERMAL_PRESERVATIVE_USED
         , A.SAMPLETRANSPORTSTORAGEDESC     as SAMPLE_TRANS_STORAGE
         , A.AnalysisStartTime              as AnalysisStartTime
         , A.AnalysisEndTime                as AnalysisEndTime
         , A.MethodSpeciationName           as MethodSpeciationName
         , A.ResultLaboratoryCommentCode    as ResultLaboratoryCommentCode
         , A.UnidentifiedSpeciesIdentifier  as UnidentifiedSpeciesIdentifier
      FROM TMP_CHEMACTIVITYRESULTS A
    WHERE A.SUBMISSION_ID = 111242
       AND A.ACTIVITYIDENTIFIER2 NOT IN
         ( SELECT ACTIVITY_IDENTIFIER FROM WQX_ACTIVITY )
    UNION
    SELECT X.WQX_ACTIVITY_GEN_ID                                             as WQX_ACTIVITY_GEN_ID
         , A.ACTIVITYIDENTIFIER2                                             as ACTIVITY_IDENTIFIER
         , (SELECT MAX(O.ORGANIZATION_NAME) FROM SYS_ORGANIZATION O WHERE O.ORGANIZATION_ID = 111242)  as ORGANIZATION_NAME
         , (SELECT MAX(P.PROJECT_IDENTIFIER) FROM SYS_PROJECT P WHERE P.PROJECT_ID = 111242) as PROJECT_IDENTIFIER
         , NVL(A.ACTIVITYTYPECODE, (SELECT MAX(ACTYP_CD) FROM REF_ACTIVITY_TYPE WHERE TO_CHAR(ACTYP_UID) = TO_CHAR(X.ACTIVITY_TYPE_CD))) as ACTIVITY_TYPE_CD
         , NVL(A.ActivityMediaName, X.ACTIVITY_MEDIA_NAME)                   as ACTIVITY_MEDIA_NAME
         , NVL(A.ActivityMediaSubDivisionName, X.MEDIA_SUB_DIVISION)         as MEDIA_SUB_DIVISION
         , NVL(A.ActivityStartDate, TO_CHAR(X.ACTIVITY_START_DTTM, 'YYYY-MM-DD')) as ACTIVITY_START_DATE
         , CASE WHEN A.ActivityStartTime is not NULL THEN
                     substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'
                WHEN A.ActivityStartTime is NULL THEN ''
           END as ACTIVITY_START_TIME
    --   , NVL((substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'), TO_CHAR(X.ACTIVITY_START_DTTM, 'HH24:MI:SS')) as ACTIVITY_START_TIME
         , NVL(A.ACTIVITYENDDATE, TO_CHAR(X.ACTIVITY_END_DTTM, 'YYYY-MM-DD'))     as ACTIVITY_END_DATE
         , NVL(A.ACTIVITYENDDATE, TO_CHAR(X.ACTIVITY_END_DTTM, 'HH24:MI:SS'))     as ACTIVITY_END_TIME
         , NVL(A.TIMEZONECODE1, X.TIME_ZONE_CD)                              as TIME_ZONE_CD
         , NVL(A.ActivityRelativeDepthName, X.RELATIVE_DEPTH_NAME)           as RELATIVE_DEPTH_NAME
         , X.DEPTH_HEIGHT_MEASURE                                            as DEPTH_HEIGHT_MEASURE
         , X.DEPTH_HEIGHT_UNIT                                               as DEPTH_HEIGHT_UNIT
         , NVL(111242, X.MONITORING_LOC_ID)                     as MONITORING_LOC_ID
         , NVL(A.ACTIVITYCOMMENTTEXT, X.COMMENT_)                            as COMMENT_
         , NVL(A.SamplerName, X.SAMPLER_NAME)                                as SAMPLER_NAME
         , NVL(A.ActivityArea, X.ACTIVITY_AREA)                              as ACTIVITY_AREA
         , NVL(A.ReportingRound, X.REPORTING_ROUND)                          as REPORTING_ROUND
         , NVL(A.SamplePanel, X.SAMPLEPANEL)                                 as SAMPLEPANEL
         , NVL(A.DataIncludedinReport, X.DATA_INCLUDED_IN_REPORT)            as DATA_INCLUDED_IN_REPORT
         , NVL(A.FlowStatusIndicator, X.FLOW_STATUS_IND)                     as FLOW_STATUS_IND
         , NVL(A.SampleChainOfCustody, X.SAMPLE_COC)                         as SAMPLE_COC
         , NVL(A.ActivitySeason, X.ACTIVITY_SEASON)                          as ACTIVITY_SEASON
         , NVL(A.RunoffImpact, X.RUNOFF_IMPACT)                              as RUNOFF_IMPACT
         , (111242)                                             as MONI_LOC_ID
         , (SELECT MAX(B.MONI_LOC_IDENTIFIER) FROM WQX_MONITORING_LOC B WHERE B.MONI_LOC_IDENTIFIER = A.MONITORINGLOCATIONIDENTIFIER) as MONI_LOC_IDENTIFIER
         , 111242                                                      as PROJECT_ID
         , X.BIO_ASSEMB_SAMPLED_NAME                                         as BIO_ASSEMB_SAMPLED_NAME
         , X.BIO_TOXICITY_TEST_TYPE                                          as BIO_TOXICITY_TEST_TYPE
         , NVL(A.METHODIDENTIFIER1, X.SAMPLE_COLLECT_METHOD_IDENTIFI)        as SAMPLE_COLLECT_METHOD_IDENTIFI
         , NVL(A.METHODIDENTIFIERCONTEXT1, X.SAMPLE_COLLECT_METHOD_CONTEXT)  as SAMPLE_COLLECT_METHOD_CONTEXT
         , X.SAMPLE_COLLECT_METHOD_NAME                                      as SAMPLE_COLLECT_METHOD_NAME
         , X.SAMPLE_COLLECT_QUALIFIER_TYPE                                   as SAMPLE_COLLECT_QUALIFIER_TYPE
         , NVL(A.METHODDESCRIPTIONTEXT1, X.SAMPLE_COLLECT_DESC)              as SAMPLE_COLLECT_DESC
         , NVL(A.SampleCollectionEquipmentName, X.SAMPLE_COLLECT_EQUIP_NAME) as SAMPLE_COLLECT_EQUIP_NAME
         , NVL(A.SAMPLECOLLECTIONEQUIPMENTTXT, X.SAMPLE_COLLECT_EQUIP_DESC)  as SAMPLE_COLLECT_EQUIP_DESC
         , NVL(A.METHODNAME2, X.SAMPLE_PREP_METHOD_NAME)                     as SAMPLE_PREP_METHOD_NAME
         , NVL(A.METHODIDENTIFIER2, X.SAMPLE_PREP_METHOD_IDENTIFIER)         as SAMPLE_PREP_METHOD_IDENTIFIER
         , NVL(A.METHODIDENTIFIERCONTEXT2, X.SAMPLE_PREP_METHOD_CONTEXT)     as SAMPLE_PREP_METHOD_CONTEXT
         , X.SAMPLE_PREP_QUALIFIER_TYPE                                      as SAMPLE_PREP_QUALIFIER_TYPE
         , NVL(A.METHODDESCRIPTIONTEXT1, X.SAMPLE_PREP_DESC)                 as SAMPLE_PREP_DESC
         , NVL(A.SampleContainerTypeName, X.SAMPLE_CONTAINER_TYPE)           as SAMPLE_CONTAINER_TYPE
         , NVL(A.SampleContainerColorName, X.SAMPLE_CONTAINER_COLOR)         as SAMPLE_CONTAINER_COLOR
         , NVL(A.ChemicalPreservativeUsedName, X.CHEM_PRESERVATIVE_USED)     as CHEM_PRESERVATIVE_USED
         , NVL(A.ThermalPreservativeUsedName, X.THERMAL_PRESERVATIVE_USED)   as THERMAL_PRESERVATIVE_USED
         , NVL(A.SAMPLETRANSPORTSTORAGEDESC, X.SAMPLE_TRANS_STORAGE)         as SAMPLE_TRANS_STORAGE
         , NVL(A.AnalysisStartTime, '')                                      as AnalysisStartTime
         , NVL(A.AnalysisEndTime, '')                                        as AnalysisEndTime
         , NVL(A.MethodSpeciationName, '')                                   as MethodSpeciationName
         , NVL(A.ResultLaboratoryCommentCode, '')                            as ResultLaboratoryCommentCode
         , NVL(A.UnidentifiedSpeciesIdentifier, '')                          as UnidentifiedSpeciesIdentifier
      FROM TMP_CHEMACTIVITYRESULTS A
           JOIN WQX_ACTIVITY X ON A.ACTIVITYIDENTIFIER2 = X.ACTIVITY_IDENTIFIER
    WHERE A.SUBMISSION_ID = 111242;

  • How does repeated snapshot import impact tablespace free space?

    Hello,
    Our client is doing DEC-2014 reconciliation in FCM. Every time he changes profile mappings he has to do snapshot import again. So far he did at least ten times snapshot import for DEC-2014 period. In our FCM database Tablespace FCM_TX_TS_DATA free space is reduced 7 GB for this period already by querrying dba_free_space table.
    By my understanding during the repeated snapshot import for the same period, the previous load data is deleted and the current load data is inserted. After data delete the table space will not be set free, and high water mark will not be reset.
    During snapshot import will the deleted blocks from the previous load be reclaimed when new load data is inserted in the table? If not, what is the best way to reclaim the free space in FCM_TX_TS_DATA tablespace?
    Thanks,
    Hongfei Liu (AT&T)

    Przemek P wrote:
    Hallo. I need to replace all schemas from one server to another. I want to know how much free space will be left on /data after this kind of refresh. Both servers are Oracle 9 so I will use exp/imp. Here is how I do it. Could you check if I think good? On target server there is 72 GB free space on /data.
    Filesystem Size Used Avail Capacity Mounted
    /dev/vgsmxdata/lvsmxcopy 194.74G 122.56G 72.18G 63% /data
    Overall size of schemas to be exported from SOURCE_DB is 150 GB. The same schemas on TARGET_DB takes 90GB. So difference is 60GB. Free space in datafiles in TARGET_DB is 30GB. Does it mean that in first place the free space in datafiles will be filled and after that datafiles would be extended? That would mean that a database would extend to 150GB and free space on /data would be 40 GB after refresh. Am I right?
    yes

  • Calculating free space in tablespace

    Oracle 11.0.1.7:
    I am trying to calculate free space in the tablespace but I am not sure if Allocated Space (bytes_used) also has some free space that doesn't get reflected in the query below. Is it correct to assume that bytes_used is the space allocated to extents but may not have been really used (no data or LOB) yet? How do I calculate space that's currently been used by row data, index data or blob data?
    I am currently using below query:
    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

    DBA_FREE_SPACE give you the free space information which has not been allocated to any segment. The segments can also have free space in their allocated space and in order to find that, use DBMS_SPACE.SPACE_USAGE procedure. To find out free space in LOB segments refer to metalink doc: 386341.1
    Thanks
    Daljit Singh

  • Data files free space calculation

    Hi,
    I have a query that calculates the Max Size (MB), Allocated (MB), Used (MB) and Used (%) for each data file in a 10.2 database.
    The results from this query are similar to what I see in dbconsole or EMconsole except for the undo datafile, my script says +- 50% used,
    dbconsole says 97% used and EM console says 0% used... does anyone have an idea what might be the cause of this?
    SELECT ddf.file_id "File#",
    ddf.file_name "Name",
    (ddf.maxbytes/1024/1024) "Max Size (MB)",
    (ddf.bytes/1024/1024) "Allocated (MB)",
    ((ddf.bytes) - NVL(SUM(dfs.bytes), 0))/1024/1024 "Used (MB)",
    ((((ddf.bytes) - NVL(SUM(dfs.bytes), 0))/ddf.bytes)*100) "Used (%)",
    ddf.autoextensible "AutoExt.",
    ((ddf.bytes/ddf.blocks)*ddf.increment_by)/1024/1024 "Increment By (MB)"
    FROM
    dba_data_files ddf, dba_free_space dfs
    WHERE
    ddf.file_id = dfs.file_id(+)
    GROUP BY ddf.file_id, ddf.file_name, ddf.maxbytes, ddf.bytes, ddf.autoextensible, ddf.increment_by, ddf.blocks
    ORDER BY ddf.file_id;
    I also try to calculate the same numbers for the temp datafile, I know that there is dba_temp_files and v$tempfile,
    but how do I calculate the used space in the temp file ?
    Thanks!
    Pieter

    Hi,
    i used following query to see the free in space in tablespace,u can also try with it.
    SELECT a.tablespace_name TSNAME, SUM(a.tots)/1048576 Tot_Size,
    SUM(a.sumb)/1048576 Tot_Free,
    SUM(a.sumb)*100/sum(a.tots) Pct_Free,
    SUM(a.largest)/1048576 Large_Ext, SUM(a.chunks) Fragments
    FROM (SELECt tablespace_name, 0 tots, SUM(bytes) sumb,
    MAX(bytes) largest, COUNT(*) chunks
    FROM dba_free_space a
    GROUP BY tablespace_name
    UNION
    SELECT tablespace_name, SUM(bytes) tots, 0, 0, 0
         FROM dba_data_files
    GROUP BY tablespace_name) a
    GROUP BY a.tablespace_name
    for free/used space in temp tablespace
    SELECT tablespace_name, SUM(bytes_used)/1024/1024 "Tot Used Space in MB", SUM(bytes_free)/1024/1024 "Tot Free Space in MB"
    FROM V$temp_space_header
    GROUP BY tablespace_name;
    Thanks
    Kuljeet

  • Checking space in a tablespace ... yes, that one again

    I know this has been done to death, but I wanted to just go over what I do when OEM alerts me to a tablespace running out of space.
    First, I check the free space of the tablespace using this query:
    SET LINESIZE 100
    COLUMN TABLESPACE FORMAT A15
    select t.tablespace,  t.totalspace as " Totalspace(MB)",
    round((t.totalspace-fs.freespace),2) as "Used Space(MB)",
    fs.freespace as "Freespace(MB)",
    round(((t.totalspace-fs.freespace)/t.totalspace)*100,2) as "% Used",
    round((fs.freespace/t.totalspace)*100,2) as "% Free"
    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;
    Secondly, I check if it is autoextendible and what the MAXBYTES is.
    select file_name, bytes/1024/1024 size_MB, AUTOEXTENSIBLE, maxbytes/1024/1024 maxsize_MB from dba_data_files where tablespace_name = 'RBPTAB';
    To my understanding, if you don't do this you wont allow for what the datafile has been allowed to autoextend up to.  The first query will only give allocated size, not the real, actual, TOTAL size that it can grow to.
    Once you know that, from query 1, there is no space left, and from 2 it is really hitting its MAXSIZE,  (compare the MAXSIZE of 2 with the Used Space(MB) column from 1) ... then add a new one.
    Does this make sense?

    so much titles included, i think you should have to reduce the size of the sql query, to understand in a meaningful way,  

  • Query to find out pertcular schema related datafiles free space????

    hai,
    whats the query to find out free space in datafiles and index files related free space for perticular schmea?
    Regards
    dba

    If you wish to get free space in index tablespace then use following query:
    select b.tablespace_name, tbs_size SizeMb, a.free_space FreeMb
    from
    (select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
    from dba_free_space group by tablespace_name) a,
    (select tablespace_name, sum(bytes)/1024/1024 as tbs_size
    from dba_data_files group by tablespace_name
    UNION
    select tablespace_name, sum(bytes)/1024/1024 tbs_size
    from dba_temp_files
    group by tablespace_name ) b
    where a.tablespace_name(+)=b.tablespace_name
    and a.tablespace_name='INDX';
    and if you get info for all tablespace then :
    select b.tablespace_name, tbs_size SizeMb, a.free_space FreeMb
    from
    (select tablespace_name, round(sum(bytes)/1024/1024 ,2) as free_space
    from dba_free_space group by tablespace_name) a,
    (select tablespace_name, sum(bytes)/1024/1024 as tbs_size
    from dba_data_files group by tablespace_name
    UNION
    select tablespace_name, sum(bytes)/1024/1024 tbs_size
    from dba_temp_files
    group by tablespace_name ) b
    where a.tablespace_name(+)=b.tablespace_name;

  • Temp tablespace 99%full

    What are the suggestion for temp tablespace, if its 99%full, should we keep adding space in it or it will use existing space?
    TABLESPACE TOTAL_MB USED_MB FREE_MB PCT_USED GRAPH (X=5%)
    TEMP 17,500.00 17,444.00 56.00 99.68 [XXXXXXXXXXXXXXXXXXX-]

    Hi,
    >>What are the suggestion for temp tablespace, if its 99%full, should we keep adding space in it or it will use existing space?
    I think that you don't need worry about, unless you're receiving some ORA- error about out of space in TEMP tablespace. You can see below an SQL output from a database used here in my company for development and tests purposes. The database is up uninterruptedly by 7 months and the space size for the TEMP tablespace have been configured to use 900 MB.
    LEGATTI@ORACLE10> SELECT tablespace_name, SUM(bytes_used), SUM(bytes_free)
      2  FROM   V$temp_space_header
      3  GROUP  BY tablespace_name;
    TABLESPACE_NAME                SUM(BYTES_USED) SUM(BYTES_FREE)
    TEMP                                 943718400               0Cheers
    Legatti

  • How to find the sessions/user consuming more temp tablespace

    Environment details
    IBM-AIX 64 bit
    Oracle 10.2.0.4.0
    Recently we encountered the issue of sudden peak in CPU utilization and temp tablespace usage. We are noticing this issue after Apr CPU 2009 patch and upgrade to 10.2.0.4.
    Recently temp space was full and we added 18 GB of space to temp tablespace, within few hours, they are also consumed.
    Application team is telling that they did not modify any code. ADDM report suggests most of the recommendations related to SQL tuning only
    not sure about the real issue. Can somebody tell me how I can find what are all sessions/user consuming high temp tablespace
    Edited by: user1368801 on Sep 1, 2009 5:32 PM

    Hi,
    Run below query to check if it is used by any session.
    select sum(a.BYTES_USED)/1024/1024 used_mb, sum(b.bytes)/1024/1024 total_mb,
    sum(a.BYTES_USED)/sum(b.bytes)*100 pct_used
    from V$TEMP_EXTENT_POOL a, v$tempfile b
    where a.file_id(+) = b.file#
    Check who is using it by the below query.
    SELECT s.sid,s.serial#,osuser,process,program,s.sql_hash_value,u.extents, u.blocks
    FROM v\$session s, v\$sort_usage u
    WHERE s.saddr = u.session_addr order by extents,blocks desc
    Hope this solves your issue.
    Regards
    Regards,
    Satishbabu Gunukula
    Click here to improve RMAN backup Performance using [Block change tracking in Oracle 10g|http://oracleracexpert.blogspot.com/2009/09/block-change-tracking-in-oracle-10g.html]
    http://oracleracexpert.blogspot.com

Maybe you are looking for

  • Generating Excel file using PL/SQL

    Hi, I wanted to generate the excel file using the below pasted PL/SQL which I have downloaded from one of the tech sites. And as I have very limited knowledge about PL/SQL I really dont know how & where I should compile this below mentioned code and

  • Reg smartforms -  creating a new page for each customer number

    Dear friends, This is a sample program for smartform. Below is my coding ... TABLES : KNA1. SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR. TYPES : BEGIN OF ZFS_KNA1,         KUNNR TYPE KNA1-KUNNR,          NAME1 TYPE KNA1-NAME1,         ORT01 TYPE KNA1-ORT

  • How to print our several Billing documents in one spool request?

    Hello all, I encountered a problem while printing billing document. Currently, we only can use VF02 to change billing document's condition type and print out Billing document. It's troublesome and waste a lot of time to change output condition type i

  • How do you save a pdf to iBooks in ios7?

    How can I save a pdf attachment to an email to iBooks in ios7?

  • Beanshell and Java

    Hello, I need to provide ability to dynamically change the behaviour of charts using Beanshell. I have been looking at Beanshell site but couldn't get any examples. Here is what I am trying to achieve. In my dashboard application, I set the basic pro