Recrear tablespace temp

— consultar archivos del tablespace actual

select tablespace_name,file_name from dba_temp_files;

qué sesión esta usando el tablespace temp, para matarla antes de borrarlo/

select 'ALTER SYSTEM KILL SESSION ''' || s.sid || ',' ||s.serial# || ''' immediate;',
tu.username,s.sid,s.serial#, s.status  from v$tempseg_usage tu, v$session s
where tu.session_addr=s.saddr;

— Crear un tablespace temporal para poder borrar el actual y ponerlo por defecto

CREATE TEMPORARY TABLESPACE TEMP2 TEMPFILE '+DATA' SIZE 20M;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP2;

— Borrar el tablespace actual

DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES;

— Recrear el tablespace

CREATE TEMPORARY TABLESPACE TEMP TEMPFILE '+data' SIZE 30G;
alter tablespace temp add TEMPFILE '+data' SIZE 10G;


volver a poner el tablespace por defecto y borrar el que se habia creado

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP;

DROP TABLESPACE temp2 INCLUDING CONTENTS AND DATAFILES;

Deja un comentario