Come eliminare e creare un tablespace temporaneo

Le Temporary tablespace vengono utilizzate per gestire lo spazio per le operazioni di ordinamento del database e per memorizzare le tabelle temporanee globali. Ad esempio, se si uniscono due tabelle di grandi dimensioni e Oracle non può eseguire l’ordinamento in memoria (vedere il parametro di inizializzazione SORT_AREA_SIZE), lo spazio verrà allocato in un tablespace temporaneo per eseguire l’operazione di ordinamento. Altre operazioni SQL che potrebbero richiedere l’ordinamento del disco sono: CREATE INDEX, ANALYZE, Select DISTINCT, ORDER BY, GROUP BY, UNION, INTERSECT, MINUS, Sort-Merge joins, ecc.

1.     Crea una nuova Temporary Tablespace

CREATE TEMPORARY TABLESPACE TEMP2TEMPFILE  ‘/xxx/xxx/temp02′ SIZE 500m;

2.     Modifica la default Temporary Tablespace del database

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP2;          

3. Controlla che nessuna sessione stia usando la vecchia Temp tablespace

SELECT USERNAME, SESSION_NUM, SESSION_ADDR FROM V$SORT_USAGE;
If you find some sort of operation in progress, wait until the terms or manually end the process

USERNAME                       SESSION_NUM        SESSION_ADDR

——————————   ———————      —————————

SYS                                      65                              000007FF646EDE68

 

4.       Elimina la  vecchia temp tablespace

DROP TABLESPACE TEMP1 INCLUDING CONTENTS AND DATAFILES;

5.       Ricrea la tablespace temp1

CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE /xxx/xxx/temp01′ SIZE 500M;

6.       Sposta la Tablespace Temp, nella nuova temp tablespace 

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP1;

7.       Elimina la tablespace temp2 perchè la temporary tablespace di default è temp1

DROP TABLESPACE TEMP2 INCLUDING CONTENTS AND DATAFILES;

http://www.orafaq.com/node/2

http://dbafix.blogspot.it/2010/08/how-to-drop-and-recreate-temp.html

Potrebbero interessarti anche...

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *