Temporary Tablespace Sizing and SNOTE 164925

Hi All,
I am facing a dilemma when I look into the temporary tablespace setting.
I have gone thru the SNOTE 164925, for the sizing parameters of PSAPTEMP.
There is a calculation on the note for selecting initial extent next extent etc.....
My PSAPTEMP is locally managed and having default initial extent value of 1 MB but as per the calculation given on SNOTE 164925 solution section.
But the point is in the How Can I check the specified value section on the same note it says....
"As of Oracle 8i, SAP recommends using the assignment of locally managed
temporary tablespaces (see Notes 659946 and 662900). This means that when
problems with a 'dictionary managed' temporary tablespace occur, you should
change to a 'locally managed' temporary tablespace instead of optimizing
the settings of the 'dictionary managed' temporary tablespace."
Now my question is whther I should still go with the default value or with the new values as per the formula given in the same note.
I am using Oracle 10g behind SAPR3 4.6D
Regards,
Soumen

Hello Soumen,
to be honest - i don't really understand your question / problem.
Just use locally managed temporary tablespace and set an uniform size.
The values initial, next and pctincrease doesn't matter in this case. Set the uniform size to 1 - 5 MB.
As you told us you are using oracle 10g .. just check the documenation:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7003.htm#CJAIDDDB
Specify LOCAL if you want the tablespace to be locally managed. Locally managed tablespaces have some part of the tablespace set aside for a bitmap. This is the default for permanent tablespaces. Temporary tablespaces are always automatically created with locally managed extents.
AUTOALLOCATE specifies that the tablespace is system managed. Users cannot specify an extent size. You cannot specify AUTOALLOCATE for a temporary tablespace.
UNIFORM specifies that the tablespace is managed with uniform extents of SIZE bytes.The default SIZE is 1 megabyte. All extents of temporary tablespaces are of uniform size, so this keyword is optional for a temporary tablespace. However, you must specify UNIFORM in order to specify SIZE. You cannot specify UNIFORM for an undo tablespace.
Restriction on Dictionary-managed Tablespaces
You cannot specify DICTIONARY if the SYSTEM tablespace of the database is locally managed or if you have specified the temporary_tablespace_clause.
Regards
Stefan

Similar Messages

  • Temporary tablespace - used and freespace size and percentage

    Hi,
    anyone here have a gd script to query the above?
    need to correctly calculate.
    thanks

    You should be more concerned of what's being used in temporary tablespace. As Oracle will reuse temp segment, free space in temp tablespace is not a good indicator.
    select * from v$sort_usage;

  • Shrinking a Locally Managed Temporary Tablespace

    So, even thoguh the documentation is pretty clear about how to use this feature, I cannot get it to do what I expect it to do for me.
    And that would be shrinking the tempfile ;)
    Now lets face it, I have a large tempfile and want to resize it without restarting the database:
    C:\Users\Administrator>sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.2.0 Production on Di Nov 20 05:49:59 2012
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
    SQL> select file_name
    , ceil(bytes / 1024 / 1024) "size MB"
    from dba_temp_files
    FILE_NAME size MB
    R:\MXVC01\TEMP01.DBF 31,231
    SQL> select su.username
    , ses.sid
    , ses.serial#
    , su.tablespace
    , ceil((su.blocks * dt.block_size) / 1048576) MB
    from v$sort_usage su
    , dba_tablespaces dt
    , v$session ses
    where su.tablespace = dt.tablespace_name
    and su.session_addr = ses.saddr
    USERNAME SID SERIAL# TABLESPACE MB
    VPXADMIN 15 15 TEMP 14
    VPXADMIN 17 5 TEMP 1,203
    VPXADMIN 17 5 TEMP 1
    VPXADMIN 18 3 TEMP 7
    VPXADMIN 19 3 TEMP 1
    VPXADMIN 144 3 TEMP 1
    VUMADMIN 156 2597 TEMP 1
    7 rows selected.
    Or this one:
    SQL> select tablespace_size/1024/1024 "tablespace_size mb"
    , allocated_space/1024/1024 "allocated_space mb"
    , free_space/1024/1024 "free_space mb"
    from dba_temp_free_space
    tablespace_size mb allocated_space mb free_space mb
    31230,9922 1228,99219 30002
    Documetation from here: http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces007.htm#ADMIN12353
    +"Shrinking a Locally Managed Temporary Tablespace+
    +Large sort operations performed by the database may result in a temporary tablespace growing and occupying a considerable amount of disk space. After the sort operation completes, the extra space is not released; it is just marked as free and available for reuse. Therefore, a single large sort operation might result in a large amount of allocated temporary space that remains unused after the sort operation is complete. For this reason, the database enables you to shrink locally managed temporary tablespaces and release unused space.+
    +You use the SHRINK SPACE clause of the ALTER TABLESPACE statement to shrink a temporary tablespace, or the SHRINK TEMPFILE clause of the ALTER TABLESPACE statement to shrink a specific tempfile of a temporary tablespace. Shrinking frees as much space as possible while maintaining the other attributes of the tablespace or tempfile. The optional KEEP clause defines a minimum size for the tablespace or tempfile.+
    +Shrinking is an online operation, which means that user sessions can continue to allocate sort extents if needed, and already-running queries are not affected.+
    +The following example shrinks the locally managed temporary tablespace lmtmp1 to a size of 20M.+
    +ALTER TABLESPACE lmtemp1 SHRINK SPACE KEEP 20M;+
    +The following example shrinks the tempfile lmtemp02.dbf of the locally managed temporary tablespace lmtmp2. Because the KEEP clause is omitted, the database attempts to shrink the tempfile to the minimum possible size.+
    +ALTER TABLESPACE lmtemp2 SHRINK TEMPFILE '/u02/oracle/data/lmtemp02.dbf';"+
    OK, lets do it:
    SQL> alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF';
    alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF'
    ERROR at line 1:
    ORA-03214: File Size specified is smaller than minimum required
    It seems there is a bug? Should I report it, or is it the expected behaviour?
    Now lets try this one:
    SQL> alter tablespace temp shrink tempfile 'R:\MXVC01\TEMP01.DBF' keep 2048M;
    Tablespace altered.
    SQL> select file_name
    , ceil(bytes / 1024 / 1024) "size MB"
    from dba_temp_files
    FILE_NAME size MB
    R:\MXVC01\TEMP01.DBF 31,231
    So .... this lasts about *10 minutes*, and nothing changes?
    It seems there is a bug? Should I report it, or is it the expected behaviour?
    Could someone enlighten me, what this SHRINK is actually doing?
    Is it worth to report this as bug, if not a software bug it is at least a documentation bug because it doesn't mention under which conditions it is working?
    P.S.: OMG the posting looks terrible, who's the one to blame for this forum software where it is not possible to use fixed size fonts, or format paragraphs as code, or what about the fact that the forum software is using default SQLPlus output as META for some graphical lines?
    Isn't this the forum for Oracle Database users?
    Edited by: Gerrit Haase on 20.11.2012 13:44

    So, you are kidding with me? No? Who are you?
    How can I block users here? Is there a moderator present at this forum?
    Maybe you read my initial post again?
    I didn't look at the wrong place.
    I reported you for general abuse.
    SQL> define
    DEFINE _DATE           = "20.11.12" (CHAR)
    DEFINE CONNECTIDENTIFIER = "MXVC01" (CHAR)
    DEFINE _USER           = "SYS" (CHAR)
    DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
    DEFINE SQLPLUSRELEASE = "1102000200" (CHAR)
    DEFINE _EDITOR         = "Notepad" (CHAR)
    DEFINE OVERSION = "Oracle Database 11g Release 11.2.0.2.0 - 64bit Production" (CHAR)
    DEFINE ORELEASE = "1102000200" (CHAR)
    SQL> SELECT * FROM dba_temp_free_space;
    TABLESPACE_NAME TABLESPACE_SIZE ALLOCATED_SPACE FREE_SPACE
    TEMP 3,2748E+10 1306517504 3,1443E+10
    SQL> select TABLESPACE_SIZE/power(2,20), ALLOCATED_SPACE/power(2,20), FREE_SPACE/power(2,20) from dba_temp_free_space ;
    TABLESPACE_SIZE/POWER(2,20) ALLOCATED_SPACE/POWER(2,20) FREE_SPACE/POWER(2,20)
    31230,9922 1245,99219 29986
    SQL> ALTER TABLESPACE temp SHRINK SPACE;
    Tablespace altered.
    SQL> select TABLESPACE_SIZE/power(2,20), ALLOCATED_SPACE/power(2,20), FREE_SPACE/power(2,20) from dba_temp_free_space ;
    TABLESPACE_SIZE/POWER(2,20) ALLOCATED_SPACE/POWER(2,20) FREE_SPACE/POWER(2,20)
    31230,9922 1244,99219 *29986*
    R:\mxvc01>dir temp
    Volume in drive R is Disk_R
    Volume Serial Number is 248B-61D4
    Directory of R:\mxvc01
    20.11.2012 08:09 32.748.077.056 TEMP01.DBF
    1 File(s) 32.748.077.056 bytes
    0 Dir(s) 8.259.297.280 bytes free
    SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF';
    alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF'
    ERROR at line 1:
    ORA-03214: File Size specified is smaller than minimum required
    *It clearly says that there is 29986 MB Space FREE and the above shrink space changes nothing and so does shrink tempfile:*
    SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF';
    alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF'
    ERROR at line 1:
    ORA-03214: File Size specified is smaller than minimum required
    SQL> alter tablespace temp shrink tempfile 'R:\mxvc01\TEMP01.DBF' KEEP 20M;
    Tablespace altered.
    R:\mxvc01>dir temp
    Volume in drive R is Disk_R
    Volume Serial Number is 248B-61D4
    Directory of R:\mxvc01
    20.11.2012 08:24 32.748.077.056 TEMP01.DBF
    1 File(s) 32.748.077.056 bytes
    0 Dir(s) 8.259.280.896 bytes free
    *... nothing changes, the tempfile isn't smaller now ...*

  • Oracle 8.0 - how to identify temporary tablespace using dba v$ views

    Hello experts,
    can someone tell me how can I query a v$ or dba_ view to identify which are the temporary tablespace in a 8.0.5 Oracle database?
    Thx in advance.

    8.0 did not have the concept of tempfiles.
    However, a Tablespace could be created as a Temporary tablespace (still using "normal" datafiles) with CREATE/ALTER TABLESPACE tablespacename TEMPORAR.
    Meaning : You can't query DBA_TEMP_FILES or V$TEMPFILEs. You have to query DBA_USERS to identify the designated Temporary Tablespace(s) and then query DBA_TABLESPACES for the storage parameters and then query DBA_DATA_FILES for the files.
    You can also query DBA_TABLESPACES for CONTENTS='TEMPORARY' and then query DBA_DATA_FILES.
    Hemant K Chitale

  • Dropping default temporary tablespace

    Hi
    (regarding Oracle 9i)
    I am getting two conflicting messages. The first one says you cannot drop a default temporary tablespace, and the second one says you can and that SYSTEM then becomes the default temporary tablespace. Which one is correct?
    http://www.idevelopment.info/data/Oracle/DBA_tips/Tablespaces/TBS_12.shtml says: The DBA cannot drop a default temporary tablespace, but it is possible to assign a new default temporary tablespace and then drop the old one. You also cannot change a default temporary tablespace to a permanent tablespace, nor can you take a default temporary tablespace offline.
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c04space.htm#1945 says: If you drop the default temporary tablespace, then the SYSTEM tablespace is used as the default temporary tablespace
    Which one is correct?!?!
    thanks

    select * from database_properties where property_name='DEFAULT_TEMP_TABLESPACE';
    PROPERTY_NAME
    PROPERTY_VALUE
    DESCRIPTION
    DEFAULT_TEMP_TABLESPACE
    TEMP
    Name of default temporary tablespace
    drop tablespace temp;
    drop tablespace temp
    ERROR at line 1:
    ORA-12906: cannot drop default temporary tablespaceBut as your earlier quotations make clear, there is nothing stopping from creating a NEW temporary tablespace, making that the default, and then dropping TEMP, the original-but-no-longer default.
    The principle is logical: a default's not much of a default if it can cease to exist. For a default to be meaningful, it has to be protected from being gotten rid of.
    The other thing you hinted at: the default default temporary tablespace is still SYSTEM, because it's the only tablespace that HAS to exist from the moment a database exists (though 10g elevates SYSAUX to almost the same status). So if you choose to create your database manually, using syntax of the form 'create database XXX....', it is allowed NOT to create a temporary tablespace. And if you choose to do that, then SYSTEM will be used as the default temporary tablespace.

  • Drop a temporary tablespace

    Hi all
    I have created a temporary tablespace temp01 and assign it as the default temporary tablespace for the database (10.0.2.0)
    How can I drop it without changing the default temporary tablespace?
    thanks for help

    phaeus wrote:
    Hello,
    create a new temporary tablespace. Make it to your default database temp tablespace and then you can drop the old one.
    A couple of thoughts I'd want to check on that - based on memories of problems in the dim and distant past.
    If you take this approach, do you still have to worry about users who have already got the dropped tablespace associated with their temp tablespace in dba_users ? Memory says they'll either get an error message, or they'll fall back to SYSTEM despite there being a new default.
    One of the reasons for creating tablespace groups for temporary tablespaces is that you can assign a tablespace group to a user, and then invisibly create and drop temporary tablespaces in that group without having to adjust the users' details. But there used to be a bug that resulted in excessive hits on dc_tablespaces if you did this, and extreme numbers of executions of a query against ts$ (or maybe file$).
    Regards
    Jonathan Lewis

  • Rapid and Huge growth of of used space of temporary tablespace

    Hi,
    Have a query (select) that run quick (no more than 10 seconds).
    As soon I insert the data into a temporary table or even on physical table, the temporary table used space starts to growth very fast. The used space is totally used and the query crash since e reach the limit (65GB), or even more if I add more table files to temporary tablespace!
    The problem also happen only if the period (dates) is one year (2013). If the period is the first trimestre of 2013 (same amount of data), the problem does not happen!!
    I also confirm that on another instance ( a test one), even with less resources this ORACLE behavior do not happen. I confirm differente execution plan queries, between the two instances .
    What I really do not understant is the behavior of the ORACLE with the huge and rapid growth!!!
    Any one experiment such a similiar situation?
    Thanks in advance,Rui
    Plan
    INSERT STATEMENT ALL_ROWSCost: 15.776 Bytes: 269 Cardinality: 1
    28 LOAD TABLE CONVENTIONAL MIDIALOG_OLAP.MED_INVCOMP_FACTTMP_BEFGROUPBY
    27 FILTER
    26 NESTED LOOPS
    24 NESTED LOOPS Cost: 15.776 Bytes: 269 Cardinality: 1
    22 NESTED LOOPS Cost: 15.775 Bytes: 255 Cardinality: 1
    19 NESTED LOOPS Cost: 15.774 Bytes: 205 Cardinality: 1
    17 NESTED LOOPS Cost: 15.773 Bytes: 197 Cardinality: 1
    14 NESTED LOOPS Cost: 15.770 Bytes: 180 Cardinality: 1
    11 NESTED LOOPS Cost: 15.767 Bytes: 108 Cardinality: 1
    9 HASH JOIN Cost: 15.757 Bytes: 8.346.500 Cardinality: 83.465
    7 HASH JOIN Cost: 13.407 Bytes: 6.345.012 Cardinality: 83.487
    5 HASH JOIN Cost: 11.163 Bytes: 5.010.550 Cardinality: 100.211
    3 HASH JOIN Cost: 5.642 Bytes: 801.288 Cardinality: 22.258
    1 INDEX RANGE SCAN INDEX MIDIALOG.IX_INSCOMP_DTCEIDICIDLCPECIDOP Cost: 120 Bytes: 489.676 Cardinality: 22.258
    2 INDEX FAST FULL SCAN INDEX (UNIQUE) MIDIALOG.IX_LINHACOMPRADA_IDLCIDOPSEQ Cost: 5.463 Bytes: 123.975.530 Cardinality: 8.855.395
    4 INDEX FAST FULL SCAN INDEX (UNIQUE) MIDIALOG.IX_LINHACOMPRADA_IDLCIDOPSEQ Cost: 5.463 Bytes: 123.975.530 Cardinality: 8.855.395
    6 TABLE ACCESS FULL TABLE MIDIALOG.ITEM_AV Cost: 1.569 Bytes: 6.963.736 Cardinality: 267.836
    8 TABLE ACCESS FULL TABLE MIDIALOG.ITEM_AV Cost: 1.572 Bytes: 7.713.672 Cardinality: 321.403
    10 INDEX UNIQUE SCAN INDEX (UNIQUE) MIDIALOG.IX_BOFINALBO_IDBOIDFINALBO Cost: 0 Bytes: 8 Cardinality: 1
    13 TABLE ACCESS BY INDEX ROWID TABLE MIDIALOG.INSERCAO_COMPRADA Cost: 3 Bytes: 72 Cardinality: 1
    12 INDEX RANGE SCAN INDEX (UNIQUE) MIDIALOG.IX_INSCOMPRADA_IDLCDATAPECAINS Cost: 2 Cardinality: 1
    16 TABLE ACCESS BY INDEX ROWID TABLE MIDIALOG.INSERCAO_ITEMFACTURA Cost: 3 Bytes: 17 Cardinality: 1
    15 INDEX RANGE SCAN INDEX MIDIALOG.IX_INSITFACT_INSCOMPRADA Cost: 2 Cardinality: 1
    18 INDEX RANGE SCAN INDEX (UNIQUE) MIDIALOG.UQ_ITEMFACTURA_IDITF_IDFACT Cost: 1 Bytes: 8 Cardinality: 1
    21 TABLE ACCESS BY INDEX ROWID TABLE MIDIALOG.FATURA Cost: 1 Bytes: 50 Cardinality: 1
    20 INDEX UNIQUE SCAN INDEX (UNIQUE) MIDIALOG.PK_FATURA Cost: 0 Cardinality: 1
    23 INDEX UNIQUE SCAN INDEX (UNIQUE) MIDIALOG.PK_TIPO_ESTADO Cost: 0 Cardinality: 1
    25 TABLE ACCESS BY INDEX ROWID TABLE MIDIALOG.TIPO_ESTADO Cost: 1 Bytes: 14 Cardinality: 1
    Edited by: rr**** on 19/Fev/2013 15:25

    I run the select with sucess, no more that 1 minute from on year of data. Few temporary used space used.
    As soon I plug the insert (global temporary table, also experiment with physical table) the used space of temporary table space start to grow crazy!!
    insert into midialog_olap.med_invcomp_facttmp_befgroupby
    select fac.numefatura,
    fac.codpessoa,
    fac.dtemiss,
    tef.nome as estado_factura,
    opsorig.demid,
    opsorig.anoplano,
    opsorig.numplano,
    opsorig.numplanilha,
    ops.nome as ordem_publicidade,
    ops.external_number as numero_externo,
    ops.estado,
    lic.seq,
    inc.data,
    inc.peca,
    fac.id_versao_plano,
    fac.ano_proforma || '.' || fac.numrf as num_proforma,
    iif.tipo_facturacao,
    opsorig.codveiculo as id_veiculo,
    opsorig.codfm as id_fornecedor_media,
    icorig.chkestado as id_estado_checking,
    0 as percentagem_comissao_agencia,
    0 as valor_pbv,
    0 as valor_stxtv,
    0 as valor_ptv,
    0 as valor_odbv,
    0 as valor_pbbv,
    0 as valor_dnv,
    0 as valor_pbnv,
    0 as valor_stxv,
    0 as valor_pbtv,
    0 as valor_dav,
    0 as valor_plv,
    0 as valor_odlv,
    0 as valor_pllv,
    0 as valor_ca,
    0 as valor_trv,
    0 as valor_txv,
    0 as valor_base_facturacao,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_pb_compra * fac.percentagem_facturada / 100))
    as valor_pbc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_stxt_compra * fac.percentagem_facturada / 100))
    as valor_stxtc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_pt_compra * fac.percentagem_facturada / 100))
    as valor_ptc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_odb_compra * fac.percentagem_facturada / 100))
    as valor_odbc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_pbb_compra * fac.percentagem_facturada / 100))
    as valor_pbbc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_dn_compra * fac.percentagem_facturada / 100))
    as valor_dnc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_pbn_compra * fac.percentagem_facturada / 100))
    as valor_pbnc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_stx_compra * fac.percentagem_facturada / 100))
    as valor_stxc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_pbt_compra * fac.percentagem_facturada / 100))
    as valor_pbtc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_da_compra * fac.percentagem_facturada / 100))
    as valor_dac,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_pl_compra * fac.percentagem_facturada / 100))
    as valor_plc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_odl_compra * fac.percentagem_facturada / 100))
    as valor_odlc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_pll_compra * fac.percentagem_facturada / 100))
    as valor_pllc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_transcricoes * fac.percentagem_facturada / 100))
    as valor_trc,
    decode(ops.estado, :WKFOPR_BOOKINGORDER_CANCELED, 0,
    decode(iif.tipo_facturacao, :BILLING_TYPE_ONLYCOMISSION, 0,
    inc.total_tx_compra * fac.percentagem_facturada / 100))
    as valor_txc,
    --nvl((select cfm.total_comprado
    -- from fin_custos_facturados_media cfm
    -- where cfm.id_factura = fac.id_factura and
    - -- cfm.id_op = ops.id_op
    -- ), 0) / opsorig.number_of_bought_insertions as custos_associados,
    0 as custos_associados,
    fac.iss as percentagem_iva,
    fac.percentagem_facturada,
    fac.currency_exchange as taxa_cambio,
    iif.associated_code as insertions_associated_code
    from fatura fac, item_fatura itf, insercao_itemfactura iif,
    insercao_comprada icorig, linha_comprada lcorig, item_av opsorig,
    med_bookingorder_finalbo opfin,
    insercao_comprada inc,
    linha_comprada lic, item_av ops,
    --veiculo vei,
    tipo_estado tef
    where fac.id_factura = itf.id_factura and
    itf.id_itemfactura = iif.id_itemfactura and
    iif.id_ic = icorig.id_ic and
    icorig.id_lc = lcorig.id_lc and
    lcorig.id_op = opsorig.id_op and
    opsorig.id_op = opfin.id_booking_order and
    opsorig.number_of_bought_insertions > 0 and
    opfin.id_final_booking_order = ops.id_op and
    -- ops.id_op = (
    -- select max(ops.id_op)
    -- from item_av ops
    -- start with ops.id_op = opsorig.id_op
    -- connect by prior ops.id_opsubstituicao = ops.id_op) and
    ops.id_op = lic.id_op and
    lic.seq = lcorig.seq and
    lic.id_op = inc.id_op and
    lic.id_lc = inc.id_lc and
    inc.data = icorig.data and
    inc.peca = icorig.peca and
    --opsorig.codveiculo = vei.codveiculo and
    fac.estado = tef.estado and
    fac.estado != 305 and
    ops.estado != 223 and
    iif.tipo_facturacao != 'SO_CA' and
    icorig.data between :dtBeginDate and :dtEndDate and
    (fac.codagenciafat = :iIdAgency or :iIdAgency is null);

  • Temporary tablespace and alert log

    If a temporary tablespace is actually filled and users get error when they are running some query, will it be updated in the alert log?
    Thanks

    It is ora-01652, and will be written to alert,
    Thanks

  • DEFAULT TABLESPACE and TEMPORARY TABLESPACE for eBusiness Suite database

    Hi:
    What is the
    DEFAULT TABLESPACE and TEMPORARY TABLESPACE
    for eBusiness Suite database.
    I want to create a new schema on the eBusiness Suite database.
    Please help

    DEFAULT TABLESPACE and TEMPORARY TABLESPACE
    for eBusiness Suite database.
    I want to create a new schema on the eBusiness Suite database.Create a new tablespace and temporary tablespace for your custom schema (you may use the existing temporary tablespace).
    Integrating Custom Applications with Oracle Applications Release 11i [ID 176852.1]
    Step By Step Guide to Creating a Custom Application in Applications 11i [ID 216589.1]
    Thanks,
    Hussein

  • Move undo and temporary tablespace to new path

    Hi All,
    I want to move my undo and temporary tablespace to new path because of space issue. I am using Oracle 10g release 2 and working on production server can't take shutdown without prior permission.
    Please tell me the steps to do so...
    thanks
    Api

    About create/change/drop
    UNDO:
    SQL>show parameter undo
    NAME TYPE VALUE
    undo_management string AUTO
    undo_retention integer 900
    undo_tablespace string UNDOTBS1
    SQL> CREATE UNDO TABLESPACE undotbs2 DATAFILE '+DATA_NEWPATH' SIZE 100M AUTOEXTEND ON;
    http://www.oracle-base.com/articles/9i/AutomaticUndoManagement.php
    SQL> alter system set undo_tablespace=undotbs2;
    *** after that can drop UNDOTBS1
    TEMP:
    SQL> CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '+DATA_NEWPATH' SIZE 500M AUTOEXTEND ON NEXT 100M MAXSIZE unlimited EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;
    http://www.idevelopment.info/data/Oracle/DBA_tips/Tablespaces/TBS_3.shtml
    SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;
    *** after that can drop old temp tablespace -> DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES

  • Undo Tablespace and Temporary Tablespace - autoextend ?

    - In general, should I allow the Undo Tablespace to grow (autoextend)?
    - In general, should I allow the Temporary Tablespace to grow (autoextend)?

    The size of undo tablespace should always keeps in mind otherwiase you eill get ORA-1555 or out of space errors.
    This paper is to help DBA’s in calculating the size of UNDO tablespace by using a simple formula.
    It is tough to know about the number of transactions and subsequently number of rows changed per second.
    So I suggest having a “big undo tablespace” to start with and based on load, after doing some calculations and resize your UNDO tablespace.
    In my case one of the applications was going to production (live), and I had no idea that how many transactions will happen against this database. All what I was told that there will be optimum (transactional) activity on this database.
    So I started with UNDO tablespace with size of 3GB and datafiles with autoextend “on” .
    Note:
    In production, you must be very careful in using this (autoextend on) as the space may grow to inifinity very fast. So my advice is either dont use this option, or use with "maxsize" or continuously monitor space (which is tough).
    I month later, I noticed the activity from V$undostat.
    Here is the step by step approach:
    Step 1: Longest running query.
    SQL> select max(maxquerylen) from v$undostat;
    MAX(MAXQUERYLEN)
    1793
    This gives you ideal value for UNDO_RETENTION. To be on the safer size you should add few more seconds to get the right value. So in my case, the size of undo retention should be say 2000 secs.
    Step 2: Size of UNDO tablespace.
    Size of UNDO needed = UNDO_RETENTION x [UNDO block Generation per sec x DB_BLOCK_SIZE] + Overhead(30xDB_BLOCK_SIZE)
    Out of these we know UNDO_RETENTION and DB_BLOCK_SIZE
    All we need is to find out “UNDO Blocks per second”
    Which can be easily fetched from v$undostat
    SQL> SELECT (SUM(undoblks))/ SUM ((end_time - begin_time) * 24*60*60) "UPS"
    2 FROM v$undostat;
    UPS
    8.11985583
    V$undostat stores data for every 10 mins and begin/end times are start/end time of those intervals. We multiplied it with 24*60*60 because the difference between two dates will be in days and to get to seconds, we need it to multiply with 24hrs*60mins*60secs
    So now we have all the values needed.
    Undo size needed = [8.12 x 2000 x 8192] + [30 x 8192] = 133283840 bytes = 127.11 MB

  • Swap, temporary tablespace and sort operations

    Hello.
    I have an Oracle 8.1.7 on Linux RH7.1. I see a very interesting situation: when users begin to execute large selects with many sorts operation swapping grows, but temporary tablespace does'nt grow. As I know, when Oracle has no memory to use as "sort_area_size" it uses temporary tablespace. But looks like that when Oracle ask for memory Linux begin to swap (in order to give memory for Oracle). I mean that Oracle don't use temporary tablespace but use swap instead of it. Is it true? Is it problem? Is it Oracle, Linux or my own configuration bug? Is it better to use swap or to use temporary tablespace? What is faster?
    Thanx for all advises and ideas. ANd sorry for pure English

    login to your database as DBA (SYS AS SYSDBA) and issue the following query:
    SQL> select name, value from v$parameter where name = 'sga_max_size' ;
    see the value defined for this parameter. If this is larger than what you have configured as your SGA size,
    Oracle will assume that it can expand the SGA to "sga_max_size" value, and will try to expand the SGA when
    required. This will result in Oracle asking more memory from the linux kernel and then linux starts to use
    the swap space.
    Try changing the value of this parameter and see if it helps.

  • Parallel execution and temporary tablespaces

    I have a large long running (1 hour) data warehouse query in a materialized view.
    If I parallelize it using the parallel hint then I run out of temporary tablespace.
    I've tried creating a bunch of temporary tablespaces and putting them into a temp tablespace group but it still runs out of space. Parallel execution seems to use up way more temp tablespace than sequential execution.
    I know it is a very general question, but what are the tips for parallelizing a long running query with respect to temporary tablespace management?
    I've tried searching on the interwebs but I don't find anything that addresses this particular issue.

    And here is the parallel explain plan:
    PLAN_TABLE_OUTPUT
    Plan hash value: 1293981491
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 81M| 17G| | 19232 (2)| 00:00:01 | | | |
    | 1 | TABLE ACCESS BY INDEX ROWID | MART$SC_SCORES | 1 | 13 | | 3 (0)| 00:00:01 | | | |
    |* 2 | INDEX UNIQUE SCAN | SSCS_SDCC_FK_I | 1 | | | 2 (0)| 00:00:01 | | | |
    | 3 | PX COORDINATOR | | | | | | | | | |
    | 4 | PX SEND QC (RANDOM) | :TQ10017 | 81M| 17G| | 19232 (2)| 00:00:01 | Q1,17 | P->S | QC (RAND) |
    |* 5 | HASH JOIN RIGHT OUTER BUFFERED | | 81M| 17G| | 19232 (2)| 00:00:01 | Q1,17 | PCWP | |
    | 6 | PX RECEIVE | | 41925 | 491K| | 2 (0)| 00:00:01 | Q1,17 | PCWP | |
    | 7 | PX SEND BROADCAST | :TQ10014 | 41925 | 491K| | 2 (0)| 00:00:01 | Q1,14 | P->P | BROADCAST |
    | 8 | PX BLOCK ITERATOR | | 41925 | 491K| | 2 (0)| 00:00:01 | Q1,14 | PCWC | |
    | 9 | INDEX FAST FULL SCAN | I_DWH_ZIP_ZIPCODE_EIDIID | 41925 | 491K| | 2 (0)| 00:00:01 | Q1,14 | PCWP | |
    |* 10 | HASH JOIN | | 81M| 16G| | 19218 (2)| 00:00:01 | Q1,17 | PCWP | |
    | 11 | JOIN FILTER CREATE | :BF0000 | 6414K| 159M| | 806 (2)| 00:00:01 | Q1,17 | PCWP | |
    | 12 | PX RECEIVE | | 6414K| 159M| | 806 (2)| 00:00:01 | Q1,17 | PCWP | |
    | 13 | PX SEND HASH | :TQ10015 | 6414K| 159M| | 806 (2)| 00:00:01 | Q1,15 | P->P | HASH |
    | 14 | PX BLOCK ITERATOR | | 6414K| 159M| | 806 (2)| 00:00:01 | Q1,15 | PCWC | |
    |* 15 | INDEX FAST FULL SCAN | I_DWH_ADDRESS_COMB_ZIP | 6414K| 159M| | 806 (2)| 00:00:01 | Q1,15 | PCWP | |
    | 16 | PX RECEIVE | | 80M| 14G| | 18397 (2)| 00:00:01 | Q1,17 | PCWP | |
    | 17 | PX SEND HASH | :TQ10016 | 80M| 14G| | 18397 (2)| 00:00:01 | Q1,16 | P->P | HASH |
    | 18 | JOIN FILTER USE | :BF0000 | 80M| 14G| | 18397 (2)| 00:00:01 | Q1,16 | PCWP | |
    |* 19 | HASH JOIN RIGHT OUTER BUFFERED | | 80M| 14G| | 18397 (2)| 00:00:01 | Q1,16 | PCWP | |
    | 20 | PX RECEIVE | | 42M| 409M| | 827 (2)| 00:00:01 | Q1,16 | PCWP | |
    | 21 | PX SEND HASH | :TQ10012 | 42M| 409M| | 827 (2)| 00:00:01 | Q1,12 | P->P | HASH |
    | 22 | PX BLOCK ITERATOR | | 42M| 409M| | 827 (2)| 00:00:01 | Q1,12 | PCWC | |
    | 23 | MAT_VIEW ACCESS FULL | MBI$CMN_ACTION_COST | 42M| 409M| | 827 (2)| 00:00:01 | Q1,12 | PCWP | |
    | 24 | PX RECEIVE | | 80M| 14G| | 17549 (1)| 00:00:01 | Q1,16 | PCWP | |
    | 25 | PX SEND HASH | :TQ10013 | 80M| 14G| | 17549 (1)| 00:00:01 | Q1,13 | P->P | HASH |
    |* 26 | HASH JOIN BUFFERED | | 80M| 14G| | 17549 (1)| 00:00:01 | Q1,13 | PCWP | |
    | 27 | PX RECEIVE | | 6312K| 794M| | 7519 (1)| 00:00:01 | Q1,13 | PCWP | |
    | 28 | PX SEND HASH | :TQ10010 | 6312K| 794M| | 7519 (1)| 00:00:01 | Q1,10 | P->P | HASH |
    |* 29 | HASH JOIN RIGHT OUTER BUFFERED | | 6312K| 794M| | 7519 (1)| 00:00:01 | Q1,10 | PCWP | |
    | 30 | VIEW | | 4443K| 80M| | 2125 (2)| 00:00:01 | Q1,10 | PCWP | |
    | 31 | HASH GROUP BY | | 4443K| 33M| 158M| 2125 (2)| 00:00:01 | Q1,10 | PCWP | |
    | 32 | PX RECEIVE | | 10M| 78M| | 950 (1)| 00:00:01 | Q1,10 | PCWP | |
    | 33 | PX SEND HASH | :TQ10007 | 10M| 78M| | 950 (1)| 00:00:01 | Q1,07 | P->P | HASH |
    | 34 | PX BLOCK ITERATOR | | 10M| 78M| | 950 (1)| 00:00:01 | Q1,07 | PCWC | |
    | 35 | TABLE ACCESS FULL | DWH$PHONE | 10M| 78M| | 950 (1)| 00:00:01 | Q1,07 | PCWP | |
    |* 36 | HASH JOIN | | 6312K| 680M| | 5392 (1)| 00:00:01 | Q1,10 | PCWP | |
    | 37 | PX RECEIVE | | 6329K| 36M| | 130 (2)| 00:00:01 | Q1,10 | PCWP | |
    | 38 | PX SEND HASH | :TQ10008 | 6329K| 36M| | 130 (2)| 00:00:01 | Q1,08 | P->P | HASH |
    | 39 | PX BLOCK ITERATOR | | 6329K| 36M| | 130 (2)| 00:00:01 | Q1,08 | PCWC | |
    | 40 | INDEX FAST FULL SCAN | PK_DWH_DEBTOR | 6329K| 36M| | 130 (2)| 00:00:01 | Q1,08 | PCWP | |
    | 41 | PX RECEIVE | | 6312K| 644M| | 5259 (1)| 00:00:01 | Q1,10 | PCWP | |
    | 42 | PX SEND HASH | :TQ10009 | 6312K| 644M| | 5259 (1)| 00:00:01 | Q1,09 | P->P | HASH |
    |* 43 | HASH JOIN RIGHT OUTER BUFFERED| | 6312K| 644M| | 5259 (1)| 00:00:01 | Q1,09 | PCWP | |
    | 44 | PX RECEIVE | | 3689K| 31M| | 4271 (1)| 00:00:01 | Q1,09 | PCWP | |
    | 45 | PX SEND HASH | :TQ10005 | 3689K| 31M| | 4271 (1)| 00:00:01 | Q1,05 | P->P | HASH |
    | 46 | VIEW | | 3689K| 31M| | 4271 (1)| 00:00:01 | Q1,05 | PCWP | |
    | 47 | HASH GROUP BY | | 3689K| 56M| 84M| 4271 (1)| 00:00:01 | Q1,05 | PCWP | |
    | 48 | PX RECEIVE | | 3689K| 56M| | 3653 (1)| 00:00:01 | Q1,05 | PCWP | |
    | 49 | PX SEND HASH | :TQ10003 | 3689K| 56M| | 3653 (1)| 00:00:01 | Q1,03 | P->P | HASH |
    |* 50 | HASH JOIN | | 3689K| 56M| | 3653 (1)| 00:00:01 | Q1,03 | PCWP | |
    | 51 | BUFFER SORT | | | | | | | Q1,03 | PCWC | |
    | 52 | PX RECEIVE | | 3 | 21 | | 1 (0)| 00:00:01 | Q1,03 | PCWP | |
    | 53 | PX SEND BROADCAST | :TQ10000 | 3 | 21 | | 1 (0)| 00:00:01 | | S->P | BROADCAST |
    | 54 | INLIST ITERATOR | | | | | | | | | |
    |* 55 | INDEX RANGE SCAN | I_DWH_PAYMENT_TYPE_EIDIID | 3 | 21 | | 1 (0)| 00:00:01 | | | |
    | 56 | PX BLOCK ITERATOR | | 28M| 242M| | 3648 (1)| 00:00:01 | Q1,03 | PCWC | |
    |* 57 | TABLE ACCESS FULL | DWH$PAYMENT | 28M| 242M| | 3648 (1)| 00:00:01 | Q1,03 | PCWP | |
    | 58 | PX RECEIVE | | 6312K| 589M| | 986 (2)| 00:00:01 | Q1,09 | PCWP | |
    | 59 | PX SEND HASH | :TQ10006 | 6312K| 589M| | 986 (2)| 00:00:01 | Q1,06 | P->P | HASH |
    |* 60 | HASH JOIN | | 6312K| 589M| | 986 (2)| 00:00:01 | Q1,06 | PCWP | |
    | 61 | PX RECEIVE | | 2937 | 172K| | 5 (20)| 00:00:01 | Q1,06 | PCWP | |
    | 62 | PX SEND BROADCAST | :TQ10004 | 2937 | 172K| | 5 (20)| 00:00:01 | Q1,04 | P->P | BROADCAST |
    |* 63 | HASH JOIN BUFFERED | | 2937 | 172K| | 5 (20)| 00:00:01 | Q1,04 | PCWP | |
    | 64 | PX RECEIVE | | 220 | 1540 | | 2 (0)| 00:00:01 | Q1,04 | PCWP | |
    | 65 | PX SEND HASH | :TQ10001 | 220 | 1540 | | 2 (0)| 00:00:01 | Q1,01 | P->P | HASH |
    | 66 | PX BLOCK ITERATOR | | 220 | 1540 | | 2 (0)| 00:00:01 | Q1,01 | PCWC | |
    | 67 | TABLE ACCESS FULL | DWH$MANDATOR | 220 | 1540 | | 2 (0)| 00:00:01 | Q1,01 | PCWP | |
    | 68 | PX RECEIVE | | 2937 | 152K| | 2 (0)| 00:00:01 | Q1,04 | PCWP | |
    | 69 | PX SEND HASH | :TQ10002 | 2937 | 152K| | 2 (0)| 00:00:01 | Q1,02 | P->P | HASH |
    | 70 | PX BLOCK ITERATOR | | 2937 | 152K| | 2 (0)| 00:00:01 | Q1,02 | PCWC | |
    | 71 | TABLE ACCESS FULL | DWH$PACKAGE | 2937 | 152K| | 2 (0)| 00:00:01 | Q1,02 | PCWP | |
    | 72 | PX BLOCK ITERATOR | | 6312K| 228M| | 980 (1)| 00:00:01 | Q1,06 | PCWC | |
    | 73 | TABLE ACCESS FULL | DWH$CASE | 6312K| 228M| | 980 (1)| 00:00:01 | Q1,06 | PCWP | |
    | 74 | PX RECEIVE | | 78M| 4199M| | 10016 (1)| 00:00:01 | Q1,13 | PCWP | |
    | 75 | PX SEND HASH | :TQ10011 | 78M| 4199M| | 10016 (1)| 00:00:01 | Q1,11 | P->P | HASH |
    | 76 | PX BLOCK ITERATOR | | 78M| 4199M| | 10016 (1)| 00:00:01 | Q1,11 | PCWC | |
    |* 77 | TABLE ACCESS FULL | DWH$ACTION | 78M| 4199M| | 10016 (1)| 00:00:01 | Q1,11 | PCWP | |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • Alter user default tablespace and temporary tablespace

    Hi guru,
    target : to ensure that users don't have the SYSTEM tablespace as their TEMPORARY or DEFAULT tablespace
    scenario :
    user default tablespace temporary tablespace
    xxyym system system
    Question: How to alter user ?
    tq

    In a scenario, let's say you want to make USERS the default tablespace for existing users and TEMP the default temporary tablespace, you can also create the alter statements as below into one script based on the output and run it.
    select 'ALTER USER '||username||' DEFAULT TABLESPACE USERS;'  FROM DBA_USERS WHERE DEFAULT_TABLESPACE IN('SYSTEM')
    and username not in('SYS','SYSTEM');
    select 'ALTER USER '||username||' TEMPORARY TABLESPACE TEMP;'  FROM DBA_USERS WHERE TEMPORARY_TABLESPACE IN('SYSTEM');As magnus mentioned, don't forget to do this(if USERS and TEMP is what you want to go with) :
    ALTER DATABASE DEFAULT TABLESPACE USERS;
    ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP;

  • Setting the default default tablespace and default temporary tablespace

    Is there a way to set the default default tablespace and default temporary tablespace database wide? I want to assign default and temporary tablespaces other than SYSTEM to all new users without having to explicitly define the tablespace names.

    Hi,
    Well, I assume that OP is using 10g, but exactly what you said, in Oracle 9i, it became possible to specify the default temporary tablespace in the database. In Oracle 10g, it allows all users to set up the default permanent tablespace to set the permanent tablespace used by default. Before Oracle 10g, if the default permanent tablespace is not set up when creating the user, SYSTEM tablespace will be set up as the default permanent tablespace by default.
    Cheers

Maybe you are looking for