Check tablespace

Hi brother,
i would like to check the sinagle tablespace on Oracle 10g DB, where can I found the script?
Thanks

I've used script from asktom, that's great....
set linesize 130
set pages 1000
-- Thank AskTom
-- This SQL Plus script lists freespace by tablespace
column dummy noprint
column pct_used format 999.9 heading "%|Used"
column name format a19 heading "Tablespace Name"
column Kbytes format 999,999,999 heading "KBytes"
column used format 999,999,999 heading "Used"
column free format 999,999,999 heading "Free"
column largest format 999,999,999 heading "Largest"
column max_size format 999,999,999 heading "MaxPoss|Kbytes"
column pct_max_used format 999.9 heading "%|Max|Used"
break on report
compute sum of kbytes on report
compute sum of free on report
compute sum of used on report
select (select decode(extent_management,'LOCAL','*',' ') ||
decode(segment_space_management,'AUTO','a ','m ')
from dba_tablespaces where tablespace_name = b.tablespace_name) ||
nvl(b.tablespace_name,
nvl(a.tablespace_name,'UNKOWN')) name,
kbytes_alloc kbytes,
kbytes_alloc-nvl(kbytes_free,0) used,
nvl(kbytes_free,0) free,
((kbytes_alloc-nvl(kbytes_free,0))/
kbytes_alloc)*100 pct_used,
nvl(largest,0) largest,
nvl(kbytes_max,kbytes_alloc) Max_Size,
decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100) pct_max_used
from ( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) a,
( select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_data_files
group by tablespace_name
union all
select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_temp_files
group by tablespace_name )b
where a.tablespace_name ( + ) = b.tablespace_name;
Enjoy!

Similar Messages

  • How to check Tablespace in DB2 with AS400

    Hi Guru,
    Can u please tell me how to check tablespace in db2 database with ecc5.

    Hi,
    very simple:
    DB2 on iSeries just has NO tablespaces ))
    => no check necessary
    Regards
    Volker Gueldenpfennig, consolut international ag
    http://www.consolut.de - http://www.4soi.de - http://www.easymarketplace.de

  • Checking Tablespace Fragmentation...

    Folks,
    Can someone share a high-end script for Checking Tablespace Fragmentation that shows exact numbers/values?
    The one I have shows only yes or no..
    Pasting my script below:
    Prompt Fragmentation Level in the db
    Prompt
    TTitle left "*** Fragmentation Level in the db (As of:"xdate ") from mtdb" skip2
    SELECT dfsc.tablespace_name tablespace_name,
    DECODE (
    dfsc.percent_extents_coalesced,
    100,
    (DECODE (
    GREATEST ((SELECT COUNT (1)
    FROM dba_free_space dfs
    WHERE dfs.tablespace_name = dfsc.tablespace_name),
    1),
    1,
    'No Frag',
    'Fragmented'
    'Possible Honey Comb Frag'
    fragmentation_status
    FROM dba_free_space_coalesced dfsc
    ORDER BY dfsc.tablespace_name
    ttitle off
    results:
    TABLESPACE_NAME FRAGMENTATION_STATUS
    IIS_TABS1 No Frag
    IIS_TABS2 No Frag
    IIS_TABS3 Fragmented
    IIS_TABS4 No Frag
    IIS_TABS5 No Frag
    regards,
    Lily

    Can you explain what, exactly, you mean by "tablespace fragmentation"? Assuming you are on a recent version of Oracle and using locally managed tablespaces (LMT's), fragmentation in the sense of having a chunk of space on disk that cannot be reused because it is too small is all but impossible. Technically, it is still possible in a LMT with automatic rather than uniform extent allocation, but it is exceptionally difficult in practice to come up with such a scenario.
    Tablespace fragmentation was a potential problem in long-ago days when there were dictionary-managed tablespaces (DMT's) when individual objects could have different extent allocation policies and PCTINCREASE could be specified. The solution back then was to set INITIAL = NEXT = <<some reasonable constant>> and PCTINCREASE = 0 and simulate the uniform extent allocation option of LMTs.
    Justin

  • Check TableSpace availability

    Is there any query which can check how much data a tablespace can store, I mean, how many space is used and how many space is free?
    Thank you.

    Try this one or modify as per ur requirement.
    SELECT NVL (b.tablespace_name, NVL (a.tablespace_name, 'UNKOWN')) NAME,2 mbytes_alloc mbytes, mbytes_alloc - NVL (mbytes_free, 0) used,
    3 NVL (mbytes_free, 0) free,
    4 ((mbytes_alloc - NVL (mbytes_free, 0)) / mbytes_alloc)
    5 * 100 pct_used,
    6 100
    7 - (((mbytes_alloc - NVL (mbytes_free, 0)) / mbytes_alloc) * 100)
    8 pct_free
    9 FROM (SELECT SUM (BYTES) / 1024 / 1024 mbytes_free, tablespace_name
    10 FROM SYS.dba_free_space
    11 GROUP BY tablespace_name) a,
    12 (SELECT SUM (BYTES) / 1024 / 1024 mbytes_alloc, tablespace_name
    13 FROM SYS.dba_data_files
    14 GROUP BY tablespace_name) b
    15 WHERE a.tablespace_name(+) = b.tablespace_name
    16 UNION ALL
    17 SELECT f.tablespace_name,
    18 SUM (ROUND ((f.bytes_free + f.bytes_used) / 1024 / 1024, 2)
    19 ) "total MB",
    20 SUM (ROUND (NVL (p.bytes_used, 0) / 1024 / 1024, 2)) "Used MB",
    21 SUM (ROUND ( ((f.bytes_free + f.bytes_used) - NVL (p.bytes_used, 0)
    22 )
    23 / 1024
    24 / 1024,
    25 2
    26 )
    27 ) "Free MB",
    28 (SUM (ROUND (NVL (p.bytes_used, 0) / 1024 / 1024, 2)) * 100)
    29 / (SUM (ROUND ((f.bytes_free + f.bytes_used) / 1024 / 1024, 2))),
    30 100
    31 - (SUM (ROUND (NVL (p.bytes_used, 0) / 1024 / 1024, 2)) * 100)
    32 / (SUM (ROUND ((f.bytes_free + f.bytes_used) / 1024 / 1024, 2)))
    33 FROM SYS.v_$temp_space_header f,
    34 dba_temp_files d,
    35 SYS.v_$temp_extent_pool p
    36 WHERE f.tablespace_name(+) = d.tablespace_name AND f.file_id(+) = d.file_id
    37 AND p.file_id(+) = d.file_id
    38 GROUP BY f.tablespace_name
    39 ORDER BY 4;

  • Check tablespace capacity and quota left?

    How do I check a specific tablespace capacity and quota left?
    Thanks!

    I guess you do not have 'Select any table' privilege,
    Be granted 'Select any table' by SYS or any DBA user. then try.
    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
    and Free.Tablespace_name='USERS'
    ORDER BY Total.name
    Tablespace Name                FREE_SPACE USED_SPACE TOTAL_SPACE
    USERS                             38.1875    11.8125          50

  • Query to check tablespace size and freespace

    hi experts
    i am using oracle 9i .
    want ot check freespace and size of tablespace could u plz tell me the query
    thanks
    varun

    add following for temp files -
    select sum(bytes)/1024 kbytes_alloc, tablespace_name
    from sys.dba_temp_files
    group by tablespace_name
    the new query will be
    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;
    cheers

  • Checking tablespace used space, free space in ASM

    Hi,
    I want to find the tablespace used space, free space, total space in an ASM (Automatic Storage Management) environment. What is the query for that ?
    Thanks

    want to find the tablespace used space, free spaceUse same script that u are used in non-asm environment.
    dba_data_files
    dba_free_space
    total space in an ASM (Automatic Storage Management) environment.select name, type, total_mb, free_mb, required_mirror_free_mb,
    usable_file_mb from v$asm_diskgroup;
    Thanks
    Kuljeet

  • Tablespace threshold check

    Hi all,
    my env..
    Oracle 8i
    solaris
    I am trying to check tablespace threshold chek ..below query ...this query is not working in oracle 8i ...but it is working fine in oracle 10g machines ...
    what is the reason I was unable to findout...
    Please let me know if any one knows
    select
    (select INSTANCE_NAME||'_'||HOST_NAME from v$instance ) "db_name_host_name",
    tablespace_name tablespace,
    sum(file_cnt) "# of Files",
    (sum(tp)-sum((fs + (tp-tc))))/1048576 "Used (M)",
    sum(tc)/1048576 "Allocated (M)",
    sum(tp)/1048576 "Max Extend (M)",
    round(max(100 - (100*((fs + (tp-tc))/tp)))) " % of Max Used"
    from ( select b.tablespace_name, nvl(a.free_space, 0) fs,
    b.total_poss_space tp,
    b.total_curr_space tc,
    b.file_cnt,
    b.tablespace_name ts_name
    from (
    select sum(bytes) free_space,
    tablespace_name
    from dba_free_space
    group by tablespace_name
    ) a,
    select sum(decode(autoextensible, 'YES',
    maxbytes,
    bytes)) total_poss_space,
    sum(bytes) total_curr_space,
    count(1) file_cnt,
    tablespace_name
    from dba_data_files
    group by tablespace_name
    ) b
    where a.tablespace_name (+) = b.tablespace_name
    group by tablespace_name
    having max(100 - (100*((fs + (tp-tc))/tp))) >=80
    Error at line 2
    ORA-00936: missing expression
    Script Terminated on line 1.
    Edited by: user603328 on Dec 10, 2010 7:26 AM

    Thanks ur reply...
    I am getting below issue....
    select
    (select INSTANCE_NAME||'_'||HOST_NAME from v$instance ) "db_name_host_name",
    tablespace_name tablespace,
    sum(file_cnt) "# of Files",
    (sum(tp)-sum((fs + (tp-tc))))/1048576 "Used (M)",
    sum(tc)/1048576 "Allocated (M)",
    sum(tp)/1048576 "Max Extend (M)",
    round(max(100 - (100*((fs + (tp-tc))/tp)))) " % of Max Used"
    from ( select b.tablespace_name, nvl(a.free_space, 0) fs,
    b.total_poss_space tp,
    b.total_curr_space tc,
    b.file_cnt,
    b.tablespace_name ts_name
    from (
    select sum(bytes) free_space,
    tablespace_name
    from dba_free_space
    group by tablespace_name
    ) a,
    select sum(decode(autoextensible, 'YES',
    maxbytes,
    bytes)) total_poss_space,
    sum(bytes) total_curr_space,
    count(1) file_cnt,
    tablespace_name
    from dba_data_files
    group by tablespace_name
    ) b
    where a.tablespace_name (+) = b.tablespace_name
    group by tablespace_name
    having max(100 - (100*((fs + (tp-tc))/tp))) >=80
    Error at line 2
    ORA-00936: missing expression
    Script Terminated on line 1.

  • Tablespace check inconsistant in DB02

    Run DB02:
    Under the default folder Space, double click Tablespaces, check tablespace DOCUI, we can find that there is still 157,952 KB free space and the percent used is only 31.25%. 
    However under the folder Diagnostics, double click Single System Check, it shows red alert for this tablespace DOCUI and marked as "Not enough free space available" and the percent used for it is 99%.
    Why these two folders in DB02 show different tablespace useage result?  Which one should be right?
    Thanks in advance!

    Kevin,
    Have you checked if the db statistics are updated? More information on this  - http://help.sap.com/saphelp_nw70/helpdata/en/f7/128f2161bb46f88a9a19d448ccc48b/frameset.htm
    Your basis support will be able to help you on this one.
    -Saket

  • TSPITR - Recover a Dropped Tablespace aborting due dependency over XDB.

    I found an issue using TSPITR to Recover a Dropped Tablespace when XML DB (XDB) is installed on a different tablespace from "SYSAUX".
    During execution of TSPITR RMAN use Data Pump to export/import Tablespace Metadata as Data Pump has dependency over XDB views and related objects and XDB is installed on a set of tablespace not included on dummy database then EXPDP fails.
    Errors raised ORA-39123, ORA-00376, ORA-01110.
    I didn't found any limitation about XDB location on documentation or MoS.
    This looks like a Oracle Bug.
    See this:
    XDB installed on TABLESPACE XDB.
    SQL> select owner,tablespace_name
        from dba_segments
        where owner='XDB'
         GROUP BY owner,tablespace_name ;
    OWNER                          TABLESPACE_NAME
    XDB                            XDBDropping Tablespace SOE.
    SQL> select to_char(sysdate,'dd-mm-yyyy hh24:mi:ss') actual_date from dual;
    ACTUAL_DATE
    17-12-2012 11:57:44
    SQL> drop tablespace SOE including contents and datafiles;
    Tablespace dropped.Restoring Dropped Tablespace.
    RMAN> list backup tag TAG20121217T112226;
    List of Backup Sets
    ===================
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    69      Full    995.61M    DISK        00:02:41     17-12-2012 11:25:07
            BP Key: 69   Status: AVAILABLE  Compressed: YES  Tag: TAG20121217T112226
            Piece Name: +DG_16M/prod/backupset/2012_12_17/nnndf0_tag20121217t112226_0.286.802264947
      List of Datafiles in backup set 69
      File LV Type Ckp SCN    Ckp Time            Name
      1       Full 1628648    17-12-2012 11:22:26 +DS8000_DG/prod/datafile/system.349.799325249
      2       Full 1628648    17-12-2012 11:22:26 +DS8000_DG/prod/datafile/sysaux.348.799325249
      3       Full 1628648    17-12-2012 11:22:26 +DS8000_DG/prod/datafile/undotbs1.347.799325251
      4       Full 1628648    17-12-2012 11:22:26 +DS8000_DG/prod/datafile/users.335.799325251
      5       Full 1628648    17-12-2012 11:22:26 +DS8000_DG/prod/datafile/audit_aux.287.799330083
      6       Full 1628648    17-12-2012 11:22:26
      7       Full 1628648    17-12-2012 11:22:26 +DS8000_DG/prod/datafile/xdb.311.801410833
    RMAN>
    run{
    SET NEWNAME FOR DATAFILE 6 TO "+DS8000_DG";
    RECOVER TABLESPACE SOE
    UNTIL TIME "to_date('17-12-2012 11:55:00','dd/mm/yyyy hh24:mi:ss')"
    AUXILIARY DESTINATION '/u01/app/oracle/flash_recovery_area01/stage_area_tspitr';
    executing command: SET NEWNAME
    Starting recover at 17-12-2012 12:01:29
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=18 device type=DISK
    RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time
    List of tablespaces expected to have UNDO segments
    Tablespace SYSTEM
    Tablespace UNDOTBS1
    Creating automatic instance, with SID='FCox'
    initialization parameters used for automatic instance:
    db_name=PROD
    db_unique_name=FCox_tspitr_PROD
    compatible=11.2.0.0.0
    db_block_size=8192
    db_files=200
    sga_target=280M
    processes=50
    db_create_file_dest=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr
    log_archive_dest_1='location=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr'
    #No auxiliary parameter file used
    starting up automatic instance PROD
    Oracle instance started
    Total System Global Area     292278272 bytes
    Fixed Size                     2220880 bytes
    Variable Size                109055152 bytes
    Database Buffers             176160768 bytes
    Redo Buffers                   4841472 bytes
    Automatic instance created
    List of tablespaces that have been dropped from the target database:
    Tablespace SOE
    contents of Memory Script:
    # set requested point in time
    set until  time "to_date('17-12-2012 11:55:00','dd/mm/yyyy hh24:mi:ss')";
    # restore the controlfile
    restore clone controlfile;
    # mount the controlfile
    sql clone 'alter database mount clone database';
    # archive current online log
    sql 'alter system archive log current';
    # avoid unnecessary autobackups for structural changes during TSPITR
    sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
    executing Memory Script
    executing command: SET until clause
    Starting restore at 17-12-2012 12:01:46
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=16 device type=DISK
    channel ORA_AUX_DISK_1: starting datafile backup set restore
    channel ORA_AUX_DISK_1: restoring control file
    channel ORA_AUX_DISK_1: reading from backup piece +DG_16M/prod/autobackup/2012_12_17/s_802265113.276.802265115
    channel ORA_AUX_DISK_1: piece handle=+DG_16M/prod/autobackup/2012_12_17/s_802265113.276.802265115 tag=TAG20121217T112513
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:05
    output file name=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/controlfile/o1_mf_8dy9ghpz_.ctl
    Finished restore at 17-12-2012 12:01:52
    sql statement: alter database mount clone database
    sql statement: alter system archive log current
    sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;
    contents of Memory Script:
    # set requested point in time
    set until  time "to_date('17-12-2012 11:55:00','dd/mm/yyyy hh24:mi:ss')";
    # set destinations for recovery set and auxiliary set datafiles
    set newname for clone datafile  1 to new;
    set newname for clone datafile  3 to new;
    set newname for clone datafile  2 to new;
    set newname for clone tempfile  1 to new;
    set newname for datafile  6 to
    "+DS8000_DG";
    # switch all tempfiles
    switch clone tempfile all;
    # restore the tablespaces in the recovery set and the auxiliary set
    restore clone datafile  1, 3, 2, 6;
    switch clone datafile all;
    executing Memory Script
    executing command: SET until clause
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    renamed tempfile 1 to /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_temp_%u_.tmp in control file
    Starting restore at 17-12-2012 12:01:58
    using channel ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: starting datafile backup set restore
    channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_system_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_undotbs1_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_sysaux_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00006 to +DS8000_DG
    channel ORA_AUX_DISK_1: reading from backup piece +DG_16M/prod/backupset/2012_12_17/nnndf0_tag20121217t112226_0.286.802264947
    channel ORA_AUX_DISK_1: piece handle=+DG_16M/prod/backupset/2012_12_17/nnndf0_tag20121217t112226_0.286.802264947 tag=TAG20121217T112226
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:09:15
    Finished restore at 17-12-2012 12:11:13
    datafile 6 switched to datafile copy
    input datafile copy RECID=5 STAMP=802267873 file name=+DS8000_DG/prod/datafile/soe.487.802267321
    datafile 1 switched to datafile copy
    input datafile copy RECID=6 STAMP=802267873 file name=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_system_8dy9gs09_.dbf
    datafile 3 switched to datafile copy
    input datafile copy RECID=7 STAMP=802267873 file name=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_undotbs1_8dy9ov17_.dbf
    datafile 2 switched to datafile copy
    input datafile copy RECID=8 STAMP=802267873 file name=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_sysaux_8dy9hxsc_.dbf
    contents of Memory Script:
    # set requested point in time
    set until  time "to_date('17-12-2012 11:55:00','dd/mm/yyyy hh24:mi:ss')";
    # online the datafiles restored or switched
    sql clone "alter database datafile  1 online";
    sql clone "alter database datafile  3 online";
    sql clone "alter database datafile  2 online";
    sql clone "alter database datafile  6 online";
    # recover and open resetlogs
    recover clone database tablespace  "SOE", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
    alter clone database open resetlogs;
    executing Memory Script
    executing command: SET until clause
    sql statement: alter database datafile  1 online
    sql statement: alter database datafile  3 online
    sql statement: alter database datafile  2 online
    sql statement: alter database datafile  6 online
    Starting recover at 17-12-2012 12:11:14
    using channel ORA_AUX_DISK_1
    starting media recovery
    archived log for thread 1 with sequence 15 is already on disk as file +DG_16M/prod/archivelog/2012_12_17/thread_1_seq_15.277.802267317
    channel ORA_AUX_DISK_1: starting archived log restore to default destination
    channel ORA_AUX_DISK_1: restoring archived log
    archived log thread=1 sequence=14
    channel ORA_AUX_DISK_1: reading from backup piece +DG_16M/prod/backupset/2012_12_17/annnf0_tag20121217t112512_0.264.802265113
    channel ORA_AUX_DISK_1: piece handle=+DG_16M/prod/backupset/2012_12_17/annnf0_tag20121217t112512_0.264.802265113 tag=TAG20121217T112512
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
    archived log file name=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr/1_14_801941068.dbf thread=1 sequence=14
    channel clone_default: deleting archived log(s)
    archived log file name=/u01/app/oracle/flash_recovery_area01/stage_area_tspitr/1_14_801941068.dbf RECID=141 STAMP=802267877
    archived log file name=+DG_16M/prod/archivelog/2012_12_17/thread_1_seq_15.277.802267317 thread=1 sequence=15
    media recovery complete, elapsed time: 00:00:01
    Finished recover at 17-12-2012 12:11:19
    database opened
    contents of Memory Script:
    # make read only the tablespace that will be exported
    sql clone 'alter tablespace  SOE read only';
    # create directory for datapump import
    sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''
    /u01/app/oracle/flash_recovery_area01/stage_area_tspitr''";
    # create directory for datapump export
    sql clone "create or replace directory TSPITR_DIROBJ_DPDIR as ''
    /u01/app/oracle/flash_recovery_area01/stage_area_tspitr''";
    executing Memory Script
    sql statement: alter tablespace  SOE read only
    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/flash_recovery_area01/stage_area_tspitr''
    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/app/oracle/flash_recovery_area01/stage_area_tspitr''
    Performing export of metadata...
       EXPDP> Starting "SYS"."TSPITR_EXP_FCox":
       EXPDP> ORA-39123: Data Pump transportable tablespace job aborted
    ORA-00376: file 7 cannot be read at this time
    ORA-01110: data file 7: '+DS8000_DG/prod/datafile/xdb.311.801410833'
    Removing automatic instance
    shutting down automatic instance
    database closed
    database dismounted
    Oracle instance shut down
    Automatic instance removed
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_temp_8dyb0qok_.tmp deleted
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/onlinelog/o1_mf_3_8dyb0kfp_.log deleted
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/onlinelog/o1_mf_2_8dyb0fm9_.log deleted
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/onlinelog/o1_mf_1_8dyb07xv_.log deleted
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_sysaux_8dy9hxsc_.dbf deleted
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_undotbs1_8dy9ov17_.dbf deleted
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/datafile/o1_mf_system_8dy9gs09_.dbf deleted
    auxiliary instance file /u01/app/oracle/flash_recovery_area01/stage_area_tspitr/PROD/controlfile/o1_mf_8dy9ghpz_.ctl deleted
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of recover command at 12/17/2012 12:12:19
    RMAN-06962: Error received during export of metadata
    RMAN-06965: Datapump job has stopped
    RMAN-06960:    EXPDP> Job "SYS"."TSPITR_EXP_FCox" stopped due to fatal error at 12:12:02
    RMAN>If I drop tablespace SOE and XDB on Target database and try to restore both (SOE,XDB) export will succeeds but during IMPORT Metadata RMAN will faill due XDB dependency.
    In my view, they (mean Oracle) need find way to include XDB Tablespace at DUMMY database only to export (EXPDP) Metadata purposes.
    If someone get a workaround for this error will be grateful.
    P.S: This is not a Production environment and will soon open a SR on Oracle Support.

    Hi Michael,
    I did not find solution to use TSPITR to recover dropped tablespace if XML DB is installed in a non-default tablespace (i.e outside of SYSAUX).
    As far I could understand, the only way to perform this RESTORE is using the old fashion. By creating clone database excluding all unnecessary tablespace, exporting and importing metadata from desired tablespace manually.
    Since Oracle has not solved the issue I created my own workaround.
    @All
    If someone is able to use TSPITR to restore dropped tablespace when XDB is installed in a non-default tablespace, please let me know!!!
    The procedure below is supported on All Oracle Version since 10.1 until 11.2.
    I DON'T RECOMMEND to create AUXILIARY (clone) database using the same server from TARGET because you can damage the TARGET database.
    On this example I'm using same server.
    See this example:
    ### ON TARGET DATABASE
    SQL> select count(1) SEG_COUNT from dba_segments where tablespace_name='SOE';
      SEG_COUNT
            32
    SQL> ! date
    Wed Dec 19 15:08:11 GMT-02:00 2012
    SQL> drop tablespace soe including contents and datafiles;
    Tablespace dropped.
    ### CHECK TABLESPACE TO BE EXCLUDED FROM RESTORE
    SQL> select tablespace_name
        from dba_tablespaces
         where tablespace_name not in ('SYSTEM','SYSAUX','UNDOTBS1','SOE','XDB','TEMP');
    TABLESPACE_NAME
    USERS
    AUDIT_AUX
    ### CHECK BACKUP ON TARGET DATABASE
    RMAN> list backup completed between "sysdate-1" and "sysdate";
    List of Backup Sets
    ===================
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    95      Full    986.56M    DISK        00:03:18     19-12-2012 14:41:59
            BP Key: 95   Status: AVAILABLE  Compressed: YES  Tag: TAG20121219T143840
            Piece Name: /fra/PROD/backupset/2012_12_19/o1_mf_nnndf_TAG20121219T143840_8f3vdn3q_.bkp
      List of Datafiles in backup set 95
      File LV Type Ckp SCN    Ckp Time            Name
      1       Full 1675258    19-12-2012 14:38:42 +DS8000_DG/prod/datafile/system.349.799325249
      2       Full 1675258    19-12-2012 14:38:42 +DS8000_DG/prod/datafile/sysaux.348.799325249
      3       Full 1675258    19-12-2012 14:38:42 +DS8000_DG/prod/datafile/undotbs1.347.799325251
      4       Full 1675258    19-12-2012 14:38:42 +DS8000_DG/prod/datafile/users.335.799325251
      5       Full 1675258    19-12-2012 14:38:42 +DS8000_DG/prod/datafile/audit_aux.287.799330083
      6       Full 1675258    19-12-2012 14:38:42
      7       Full 1675258    19-12-2012 14:38:42 +DS8000_DG/prod/datafile/xdb.311.801410833
    BS Key  Size       Device Type Elapsed Time Completion Time
    96      1.16M      DISK        00:00:00     19-12-2012 14:42:08
            BP Key: 96   Status: AVAILABLE  Compressed: YES  Tag: TAG20121219T144208
            Piece Name: /fra/PROD/backupset/2012_12_19/o1_mf_annnn_TAG20121219T144208_8f3vm0k3_.bkp
      List of Archived Logs in backup set 96
      Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
      1    8       1675198    19-12-2012 14:38:25 1675365    19-12-2012 14:42:07
    BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    97      Full    7.52M      DISK        00:00:02     19-12-2012 14:42:11
            BP Key: 97   Status: AVAILABLE  Compressed: NO  Tag: TAG20121219T144209
            Piece Name: /fra/PROD/autobackup/2012_12_19/o1_mf_s_802449729_8f3vm2cc_.bkp
      SPFILE Included: Modification time: 19-12-2012 14:36:30
      SPFILE db_unique_name: PROD
      Control File Included: Ckp SCN: 1675376      Ckp time: 19-12-2012 14:42:09
    RMAN>
    ### PREPARING ENV
    cp $ORACLE_HOME/dbs/orapwprod $ORACLE_HOME/dbs/orapwtspitr
    cd $ORACLE_HOME/dbs
    ## Creating INIT from TSPITR Instance
    vi inittspitr.ora
    DB_NAME=prod
    DB_UNIQUE_NAME=tspitr
    CONTROL_FILES=/stage_area_tspitr/PROD/controlfile/control01.ctl
    REMOTE_LOGIN_PASSWORDFILE=exclusive
    COMPATIBLE =11.2.0
    DB_BLOCK_SIZE=8192
    memory_target=700M
    streams_pool_size=100M
    ### creating stage area to deploy database
    mkdir -p  /fra/stage_area_tspitr/PROD
    cd /fra/stage_area_tspitr/PROD
    mkdir controlfile datafile onlinelog
    #### RESTORING DATABASE TSPITR
    export ORACLE_SID=tspitr
    $ rman target /
    RMAN> startup nomount
    Oracle instance started
    Total System Global Area     730714112 bytes
    Fixed Size                     2225088 bytes
    Variable Size                553651264 bytes
    Database Buffers             167772160 bytes
    Redo Buffers                   7065600 bytes
    RMAN> restore controlfile from '/fra/PROD/autobackup/2012_12_19/o1_mf_s_802449729_8f3vm2cc_.bkp';
    Starting restore at 19-12-2012 15:16:27
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=146 device type=DISK
    channel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
    output file name=/fra/stage_area_tspitr/PROD/controlfile/control01.ctl
    Finished restore at 19-12-2012 15:16:31
    RMAN> startup mount
    database is already started
    database mounted
    released channel: ORA_DISK_1
    ### REPORT SCHEMA TO GET DATAFILE NUMBER TO BE RESTORED
    RMAN> report schema;
    RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
    Report of database schema for database with db_unique_name TSPITR
    List of Permanent Datafiles
    ===========================
    File Size(MB) Tablespace           RB segs Datafile Name
    1    700      SYSTEM               ***     +DS8000_DG/prod/datafile/system.349.799325249
    2    600      SYSAUX               ***     +DS8000_DG/prod/datafile/sysaux.348.799325249
    3    200      UNDOTBS1             ***     +DS8000_DG/prod/datafile/undotbs1.347.799325251
    4    5        USERS                ***     +DS8000_DG/prod/datafile/users.335.799325251
    5    100      AUDIT_AUX            ***     +DS8000_DG/prod/datafile/audit_aux.287.799330083
    6    0        SOE                  ***     +DS8000_DG/tspitr/datafile/soe.368.802445265
    7    100      XDB                  ***     +DS8000_DG/prod/datafile/xdb.311.801410833
    List of Temporary Files
    =======================
    File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
    1    385      TEMP                 32767       +DS8000_DG/prod/tempfile/temp.300.799325437
    RMAN>
    ### GET LOGFILE NAME to RENAME to new location.
    $ sqlplus / as sysdba
    SQL> select member from v$logfile;
    MEMBER
    +DS8000_DG/prod/onlinelog/group_1.330.802352807
    +DS8000_DG/prod/onlinelog/group_2.331.802352815
    +DS8000_DG/prod/onlinelog/group_3.321.802352821
    run {
    set newname for datafile 1 to '/fra/stage_area_tspitr/PROD/datafile/datafiles_%U';
    set newname for datafile 2 to '/fra/stage_area_tspitr/PROD/datafile/datafiles_%U';
    set newname for datafile 3 to '/fra/stage_area_tspitr/PROD/datafile/datafiles_%U';
    set newname for datafile 7 to '/fra/stage_area_tspitr/PROD/datafile/datafiles_%U';
    set newname for datafile 6 to "+DS8000_DG";
    restore datafile 1,2,3,7,6 from tag 'TAG20121219T143840' ;
    switch datafile 1;
    switch datafile 2;
    switch datafile 3;
    switch datafile 7;
    switch datafile 6;
    switch tempfile all;
    set until time "to_date('19-12-2012 14:42:00','dd-mm-yyyy hh24:mi:ss')";
    recover database SKIP TABLESPACE  "USERS", "AUDIT_AUX" delete archivelog;
    ## Renaming ONLINELOG
    sql "alter database rename file ''+DS8000_DG/prod/onlinelog/group_1.330.802352807'' to ''/fra/stage_area_tspitr/PROD/onlinelog/group1.rdo''";
    sql "alter database rename file ''+DS8000_DG/prod/onlinelog/group_2.331.802352815'' to ''/fra/stage_area_tspitr/PROD/onlinelog/group2.rdo''";
    sql "alter database rename file ''+DS8000_DG/prod/onlinelog/group_3.321.802352821'' to ''/fra/stage_area_tspitr/PROD/onlinelog/group3.rdo''";
    alter database open resetlogs;
    executing command: SET NEWNAME
    executing command: SET NEWNAME
    Starting restore at 19-12-2012 15:32:13
    using channel ORA_DISK_1
    channel ORA_DISK_1: starting datafile backup set restore
    channel ORA_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_DISK_1: restoring datafile 00001 to /fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-SYSTEM_FNO-1
    channel ORA_DISK_1: restoring datafile 00002 to /fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-SYSAUX_FNO-2
    channel ORA_DISK_1: restoring datafile 00003 to /fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-UNDOTBS1_FNO-3
    channel ORA_DISK_1: restoring datafile 00007 to /fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-XDB_FNO-7
    channel ORA_DISK_1: restoring datafile 00006 to +DS8000_DG
    channel ORA_DISK_1: reading from backup piece /fra/PROD/backupset/2012_12_19/o1_mf_nnndf_TAG20121219T143840_8f3vdn3q_.bkp
    channel ORA_DISK_1: piece handle=/fra/PROD/backupset/2012_12_19/o1_mf_nnndf_TAG20121219T143840_8f3vdn3q_.bkp tag=TAG20121219T143840
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:12:35
    Finished restore at 19-12-2012 15:44:48
    datafile 1 switched to datafile copy
    input datafile copy RECID=6 STAMP=802453489 file name=/fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-SYSTEM_FNO-1
    datafile 2 switched to datafile copy
    input datafile copy RECID=8 STAMP=802453489 file name=/fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-SYSAUX_FNO-2
    datafile 3 switched to datafile copy
    input datafile copy RECID=10 STAMP=802453489 file name=/fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-UNDOTBS1_FNO-3
    datafile 7 switched to datafile copy
    input datafile copy RECID=12 STAMP=802453489 file name=/fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-XDB_FNO-7
    datafile 6 switched to datafile copy
    input datafile copy RECID=14 STAMP=802453489 file name=+DS8000_DG/tspitr/datafile/soe.304.802452733
    renamed tempfile 1 to /fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-TEMP_FNO-1 in control file
    executing command: SET until clause
    Starting recover at 19-12-2012 15:44:49
    using channel ORA_DISK_1
    Executing: alter database datafile 4 offline
    Executing: alter database datafile 5 offline
    starting media recovery
    archived log for thread 1 with sequence 8 is already on disk as file +DS8000_DG/prod/onlinelog/group_2.331.802352815
    archived log file name=+DS8000_DG/prod/onlinelog/group_2.331.802352815 thread=1 sequence=8
    media recovery complete, elapsed time: 00:00:02
    Finished recover at 19-12-2012 15:44:55
    sql statement: alter database rename file ''+DS8000_DG/prod/onlinelog/group_1.330.802352807'' to ''/fra/stage_area_tspitr/PROD/onlinelog/group1.rdo''
    sql statement: alter database rename file ''+DS8000_DG/prod/onlinelog/group_2.331.802352815'' to ''/fra/stage_area_tspitr/PROD/onlinelog/group2.rdo''
    sql statement: alter database rename file ''+DS8000_DG/prod/onlinelog/group_3.321.802352821'' to ''/fra/stage_area_tspitr/PROD/onlinelog/group3.rdo''
    database opened
    ## Exporting Tablespace Metadata
    RMAN >
    run {
    sql 'alter tablespace  SOE read only';
    # create directory for datapump export
    sql  "create or replace directory TSPITR_DIROBJ_DPDIR as ''/fra/stage_area_tspitr''";
    # grant on directory to SYSTEM
    sql "grant read,write on directory TSPITR_DIROBJ_DPDIR to system";
    # exporting metadata
    host "expdp system/oracle@localhost:1521/tspitr DIRECTORY=TSPITR_DIROBJ_DPDIR DUMPFILE=exp_transport_soe.dmp TRANSPORT_FULL_CHECK=Y TRANSPORT_TABLESPACES=SOE";
    using target database control file instead of recovery catalog
    sql statement: alter tablespace  SOE read only
    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/fra/stage_area_tspitr''
    sql statement: grant read,write on directory TSPITR_DIROBJ_DPDIR to system
    Export: Release 11.2.0.3.0 - Production on Wed Dec 19 15:53:02 2012
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
    Data Mining, Oracle Database Vault and Real Application Testing options
    Starting "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01":  system/********@localhost:1521/tspitr DIRECTORY=TSPITR_DIROBJ_DPDIR DUMPFILE=exp_transport_soe.dmp TRANSPORT_FULL_CHECK=Y TRANSPORT_TABLESPACES=SOE
    Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
    Processing object type TRANSPORTABLE_EXPORT/TABLE
    Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
    Processing object type TRANSPORTABLE_EXPORT/INDEX/FUNCTIONAL_INDEX/INDEX
    Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
    Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
    Processing object type TRANSPORTABLE_EXPORT/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS
    Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
    Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
    Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
    Master table "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully loaded/unloaded
    Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:
      /fra/stage_area_tspitr/exp_transport_soe.dmp
    Datafiles required for transportable tablespace SOE:
      +DS8000_DG/tspitr/datafile/soe.304.802452733
    Job "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" successfully completed at 15:54:28
    host command complete
    ## Stop Database and destroy it to make sure that Datafile 6 will not be used by this database;
    RMAN>
    run {
    shutdown immediate;
    ## removing controlfile and SYSTEM Tablespace to make sure that database will not be opened
    host "rm -f /fra/stage_area_tspitr/PROD/controlfile/control01.ctl /fra/stage_area_tspitr/PROD/datafile/datafiles_data_D-PROD_TS-SYSTEM_FNO-1";
    database closed
    database dismounted
    Oracle instance shut down
    host command complete
    ## TARGET Database
    ## Plugging Tablespace on TARGET database.
    $ export ORACLE_SID=prod
    $ rman target /
    run {
    # create directory for datapump import
    sql "create or replace directory TSPITR_DIROBJ_DPDIR as ''/fra/stage_area_tspitr''";
    # grant on directory to SYSTEM
    sql "grant read,write on directory TSPITR_DIROBJ_DPDIR to system";
    host "impdp system/oracle@localhost:1521/prod DIRECTORY=TSPITR_DIROBJ_DPDIR DUMPFILE=exp_transport_soe.dmp TRANSPORT_DATAFILES=''+DS8000_DG/tspitr/datafile/soe.304.802452733''";
    sql "alter tablespace soe read write";
    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/fra/stage_area_tspitr''
    sql statement: grant read,write on directory TSPITR_DIROBJ_DPDIR to system
    Import: Release 11.2.0.3.0 - Production on Wed Dec 19 16:09:30 2012
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
    Data Mining, Oracle Database Vault and Real Application Testing options
    Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
    Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":  system/********@localhost:1521/prod DIRECTORY=TSPITR_DIROBJ_DPDIR DUMPFILE=exp_transport_soe.dmp TRANSPORT_DATAFILES=+DS8000_DG/tspitr/datafile/soe.304.802452733
    Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
    Processing object type TRANSPORTABLE_EXPORT/TABLE
    Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
    Processing object type TRANSPORTABLE_EXPORT/INDEX/FUNCTIONAL_INDEX/INDEX
    Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/CONSTRAINT
    Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
    Processing object type TRANSPORTABLE_EXPORT/INDEX/STATISTICS/FUNCTIONAL_INDEX/INDEX_STATISTICS
    Processing object type TRANSPORTABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
    Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
    Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
    Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at 16:10:03
    host command complete
    sql statement: alter tablespace soe read write
    ### Recompiling Invalid Objects and Checking objects from  tablespace SOE
    $ sqlplus / as sysdba
    SQL>  @$ORACLE_HOME/rdbms/admin/utlrp.sql
    TIMESTAMP
    COMP_TIMESTAMP UTLRP_BGN  2012-12-19 16:10:34
    OBJECTS WITH ERRORS
                      0
    ERRORS DURING RECOMPILATION
                              0
    Function created.
    PL/SQL procedure successfully completed.
    Function dropped.
    PL/SQL procedure successfully completed.
    SQL> select count(1) SEG_COUNT from dba_segments where tablespace_name='SOE';
      SEG_COUNT
            32
    SQL> SELECT COUNT(1) OBJ_INVALID FROM DBA_OBJECTS WHERE STATUS != 'VALID';
    OBJ_INVALID
              0
    ## PERFORM A FULL BACKUP AFTER RESTORE TABLESPACE.Regards,
    Levi Pereira

  • Temporary tablespace is not being used

    hello all,
    we have oracle 10g 10.2.1.0 on windows server 2003 platform (32-bit). we have 24*7 database. we have OLTP with heavy transactions. last night we ran a report which is supposed to fetch more than 2500 rows and query include group by and order by clause.
    i have rebuild all indexes on index tablespace, which were previously on users tablespace where my all data resides.
    but it is taking too much long to generate report more that 40 minutes (expected 5 minutes) my SGA is set to 1.2 GB shared pool sixe is 500M and db_cache_size=400M. and when i check tablespace status from enterprise manager everytime , i see that temporary tablespace is never being used..it always shows that temporary tablespace usages 0.0 and i allocated 4 GB to temp tablespace and it is also default temporary tablespace.
    what else i can do to force oracle to use temporary tablespaces??? it is not using for sorting also...thats why it is taking so long to generating report..
    any suggestion would be appreciable..
    thanks and regards
    VD

    vikrant dixit wrote:
    we have oracle 10g 10.2.1.0 on windows server 2003 platform (32-bit). we have 24*7 database. we have OLTP with heavy transactions. last night we ran a report which is supposed to fetch more than 2500 rows and query include group by and order by clause.
    i have rebuild all indexes on index tablespace, which were previously on users tablespace where my all data resides.
    but it is taking too much long to generate report more that 40 minutes (expected 5 minutes) Are you saying that you tried rebuilding all your indexes because the report started to run slowly, or conversely that you rebuilt all the indexes and then the report ran slowly ?
    If it's just a report that you could simply re-run, then all you have to do is re-run it and watch exactly where the time goes (you've been told about the 10046 trace already).
    If it's a report that ran, and was tuned, regularly in the past then you presumably have the execution plan stored somewhere so you could even check the current execution plan compared to the old one to see if it has changed.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    "There's no sense in being precise when you don't even know what you're talking about"
    John von Neumann                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Tablespace size. System data vs user data.

    Hi,
    I have Oracle 11.2.0.1 on Solaris 11 x86_64. Software using SYSTEM tablespace. The free space on this tablespace is allmost end,
    When i check what amount of data is collected in database i get strange value:
    select SUM(qq.MB) from (select table_name,(num_rows*avg_row_len)/(1024*1024) MB, num_rows, avg_row_len from user_tables) qq;
    SUM(QQ.MB)            
    6,43802738189697265625
    So i suppose that data using only 6.4MB.... But statistic for this tablespace is
    Tablespace                     Used MB                Free MB                Total MB               Pct. Free             
    SYSAUX                         655                    35                     690                    5                     
    UNDOTBS1                       27                     18                     45                     40                    
    TQTBS                          11                     489                    500                    98                    
    USERS                          0                      5                      5                      100                   
    SYSTEM                         707                    93                     800                    12              
    What is using 700MB?!

    It is a very good thing to use the command line queries to understand these things.  But it is also good to know your tools.  You should check tablespace size with dbconsole, it shows nice little pictures of how much space is used.  Note that your system tablespace is autoextend, and this is a good thing, since as Sybrand noted, that's where the PL/SQL is stored.  As a practical matter, unless you are adding a lot of new code, that tablespace tends to expand to a steady size and just stay there.  You don't want to fix it there, because you might add new code in the future.
    On the other hand, sysaux and your data may need some watching.  If you are curious, you can use the tablespace map function in dbconsole to see what is where in tablespaces (and there are scripts floating about to see it command line style).  But don't stress over it, Oracle is really good about doing things right.  What you have to watch out for is things like auditing or plan maintenance becoming space hogs in sysaux, and some apps, sometimes combined with some bugs, can use too much data space.  But really, you shouldn't bother with it too much unless you see something using way more space than you would reasonably expect. 
    If you want to obsess over something, consider patching.  11.2.0.1 is not a good sign.

  • ORA-01653 unable to increase tablespace size

    We have Oracle 11gR2 RAC with ASM installed on Redhat Linux
    I am not able to extend tablespace it gives error ORA-01653
    I checked ASM views
    GROUP_NUMBER     NAME     SECTOR_SIZE     BLOCK_SIZE     ALLOCATION_UNIT_SIZE     STATE     TYPE     TOTAL_MB     FREE_MB
    1     DWH_OCR     512     4096     1048576     MOUNTED     NORMAL     3057     2131
    2     DATABASE     512     4096     1048576     CONNECTED     NORMAL     204798     1536
    Above view shows we have 1536 Mb free in our Database ASM disk group. And when i checked tablespaces used space so i found its not exceeding 70 GB.
    Please suggest/advice what can be ocuppying space in ASM? and how to free it?
    Also note archiving is also disabled. I tried to empty recycle bin also. Still same issue.
    Thanks in advance
    Zeeshan Sheikh

    select * from DBA_TABLESPACE_USAGE_METRICS;
    TABLESPACE_NAME     USED_SPACE     TABLESPACE_SIZE     USED_PERCENT
    ESECTOR_DATA     552     4194302     0.013160712
    NCC_DATA     1281408     4194302     30.55116203
    ODI_DATA     2358040     4194302     56.22008143
    QUEST_DATA     184     4194302     0.004386904
    SHOAIBA_DATA     50048     4194302     1.193237874
    SYSAUX     225720     4194302     5.381586734
    SYSTEM     521560     4194302     12.43496534
    TEMP     3200     4194302     0.076293982
    UNDOTBS1     160     4194302     0.003814699
    UNDOTBS2     16552     4194302     0.39463062
    USERS     3337400     4194302     79.56985453
    WSECTOR_DATA     192     4194302     0.004577639
    select * from v$asm_diskgroup;
    GROUP_NUMBER     NAME     SECTOR_SIZE     BLOCK_SIZE     ALLOCATION_UNIT_SIZE     STATE     TYPE     TOTAL_MB     FREE_MB     HOT_USED_MB     COLD_USED_MB     REQUIRED_MIRROR_FREE_MB     USABLE_FILE_MB     OFFLINE_DISKS     COMPATIBILITY     DATABASE_COMPATIBILITY     VOTING_FILES
    0     FLASH     512     4096     0     DISMOUNTED          0     0     0     0     0     0     0     0.0.0.0.0     0.0.0.0.0     N
    1     DWH_OCR     512     4096     1048576     MOUNTED     NORMAL     3057     2131     0     926     310     910     0     11.2.0.0.0     10.1.0.0.0     N
    2     DATABASE     512     4096     1048576     CONNECTED     NORMAL     204798     1536     0     203262     0     768     0     11.2.0.0.0     10.1.0.0.0     N

  • MTE class for total tablespace size

    Hi,
    We start a monitoring over the solutionmanager and i asked myself, if it's possible to show the total size of a tablespace.
    I only see the free and used space, but not the total.
    In moment we calculate the total space with these 2 results, but it is possible to have large difference in total. But i need these data for the reporting.
    Thanks in Advance

    It is a very good thing to use the command line queries to understand these things.  But it is also good to know your tools.  You should check tablespace size with dbconsole, it shows nice little pictures of how much space is used.  Note that your system tablespace is autoextend, and this is a good thing, since as Sybrand noted, that's where the PL/SQL is stored.  As a practical matter, unless you are adding a lot of new code, that tablespace tends to expand to a steady size and just stay there.  You don't want to fix it there, because you might add new code in the future.
    On the other hand, sysaux and your data may need some watching.  If you are curious, you can use the tablespace map function in dbconsole to see what is where in tablespaces (and there are scripts floating about to see it command line style).  But don't stress over it, Oracle is really good about doing things right.  What you have to watch out for is things like auditing or plan maintenance becoming space hogs in sysaux, and some apps, sometimes combined with some bugs, can use too much data space.  But really, you shouldn't bother with it too much unless you see something using way more space than you would reasonably expect. 
    If you want to obsess over something, consider patching.  11.2.0.1 is not a good sign.

  • Tablespace used and free space size in 9i

    Hi,
    How to find the tablespace used space and tablespace free space in 9i.
    Normally i uses below query in 10g and 11g, but this query not working in 9i. Please help the query for 9i....
    SELECT /* + RULE */ df.tablespace_name "Tablespace",
    df.bytes / (1024 * 1024) "Size (MB)",
    SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
    Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",
    Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"
    FROM dba_free_space fs,
    (SELECT tablespace_name,SUM(bytes) bytes
    FROM dba_data_files
    GROUP BY tablespace_name) df
    WHERE fs.tablespace_name (+) = df.tablespace_name
    GROUP BY df.tablespace_name,df.bytes
    UNION ALL
    SELECT /* + RULE */ df.tablespace_name tspace,
    fs.bytes / (1024 * 1024),
    SUM(df.bytes_free) / (1024 * 1024),
    Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),
    Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)
    FROM dba_temp_files fs,
    (SELECT tablespace_name,bytes_free,bytes_used
    FROM v$temp_space_header
    GROUP BY tablespace_name,bytes_free,bytes_used) df
    WHERE fs.tablespace_name (+) = df.tablespace_name
    GROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
    ORDER BY 4 DESC;
    Regards,
    Pravin

    hi,
    try this
    /* TOTAL, FREE AND USED SPACE IN TABLESPACES */ 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;
    and you can have a look this thred. it will be hellp you
    query to check tablespace size and freespace
    regards,

Maybe you are looking for

  • Command-5 shortcut for 5-star rating photos in iPhoto not working

    When I go to 5-star rate a photo in iPhoto using the default Command-5 shortcut, the shortcut no longer works. The Command-1, Command-2, Command-3, Command-4 shortcuts work for (1-star through to 4-star ratings), but for some reason Command-5 no long

  • How to GREP unique string only?

    Hi, I have a huge import log file and it's too hard to review the full log file to verify all reported errors are ignorable. So I am looking for a way to list the distinct errors. I had some manual analysis and workarounds to find out the errors howe

  • I can't see the screen in the sun

    I've searched for an answer, but can't find one. I have a 8320 and I use the theme that came with the phone. I can not see anything on the screen when there is a lot of light (i.e. outside).  Is there a theme or some kind of setting I can use to help

  • Mac mini shuts down during startup

    Lately my Mac mini running osx lion got really slow and then when I shut it down for the night the next morning I tried to boot it up. It didn't boot up after 2 hours of grey screen and spinning wheel. I tried clearing my NVRAM but nothing happened.

  • 0re_5 Real estete Data source

    Hi All, Could you please let me know the name of tables on which 0RE_5 (Real Estate- Cost) data source is built? I tried sap help to find this information but there is no luck. Thanks and regards, Harry