Oracle 11g how to estimate needed TEMP tablespace?

后端 未结 1 776
余生分开走
余生分开走 2021-01-13 10:50

We do an initial bulk load of some tables (both, source and target are Oracle 11g). The process is as follows: 1. truncate, 2. drop indexes (the PK and a unique index), 3. b

相关标签:
1条回答
  • 2021-01-13 11:04

    This is a good question.

    First, If you create the following primary key

    alter table TARGET_SCHEMA.MYBIGTABLE 
         add constraint PK_MYBIGTABLE primary key (MYBIGTABLE_PK)
    

    then you should query

    explain plan for 
         select PK_MYBIGTABLE 
         from SOURCE_SCHEMA.MYBIGTABLE 
         group by PK_MYBIGTABLE 
    

    To get an estimate (make sure you gather stats exec dbms_stats.gather_table_stats('SOURCE_SCHEMA','MYBIGTABLE').

    Second , you can query V$TEMPSEG_USAGE to see how much temp blocks were consumed before you got thrown and v$session_longops to see how much of the total process you finished.

    Oracle docs suggests creating a dedicated temp tablespace for the process to not disturb any other operations.

    Please post an edit if you find a more accurate solution.

    0 讨论(0)
提交回复
热议问题