ALTER TABLE MOVE

Il comando ALTER TABLE MOVE serve per spostare una tabella da un tablespace ad un altro.
Oracle crea nuovi segments per la tabella, copia i dati  e droppa i vecchi segments.
L'operazione di drop include la clausola PURGE quindi la tabella non viene spostata nel RecycleBin.
Durante questa operazione è possibile interrogare la tabella ma non eseguire dml.

select SEGMENT_NAME, BLOCKS ,bytes
from dba_segments
where segment_type='TABLE'
and  TABLESPACE_NAME= 'TS_PLUTO_DATA'
and segment_name = 'DOPO_SNAPSHOT'

SEGMENT_NAME      BLOCKS      BYTES
---------- --------------------------------------------
DOPO_SNAPSHOT      96                  786432

select * from dba_extents where owner ='PLUTO' and segment_name='DOPO_SNAPSHOT' ;


alter user PLUTO quota 100K on TS_PLUTO_DATA_NEW;

ALTER TABLE pluto.dopo_snapshot  
MOVE TABLESPACE ts_pluto_data_new
NOLOGGING;

La clausola NOLOGGING evita di scrivere le operazioni nei redo log files.

select SEGMENT_NAME, BLOCKS ,bytes
from dba_segments
where segment_type='TABLE'
and  TABLESPACE_NAME= 'TS_PLUTO_DATA_NEW'
and segment_name = 'DOPO_SNAPSHOT' 

SEGMENT_NAME      BLOCKS      BYTES
---------- --------------------------------------------                                                             
DOPO_SNAPSHOT      8                    65536


select * from dba_extents where owner ='pluto' and segment_name='DOPO_SNAPSHOT' 







Post popolari in questo blog

Create e Drop Pluggable Database

ORA-12154: TNS: il listener non è attualmente a conoscenza del servizio richiesto nel descrittore di connessione