Pular para o conteúdo

Fóruns Banco de dados Oracle Identificar tablespace Fragmentada Identificar tablespace Fragmentada

#101394
felipeg
Participante

    [quote=”jspaulonci”:jzxhvzj7]Boa tarde, uma vez que o Oracle escreveu no datafile, mesmo dropando os objetos não é possível dar resize, a tablespace necessita ser recriada.
    [/quote]

    Prezados, boa tarde

    Peço desculpas na demora, estava em almoço

    @Joao Paulo, discordo da sua afirmação pois o reszie funciona muito bem para datafiles que possuem espaço a ser liberado.

    http://download.oracle.com/docs/cd/B283 … les003.htm


    Manually Resizing a Datafile

    You can manually increase or decrease the size of a datafile using the ALTER DATABASE statement. This enables you to add more space to your database without adding more datafiles. This is beneficial if you are concerned about reaching the maximum number of datafiles allowed in your database.

    For a bigfile tablespace you can use the ALTER TABLESPACE statement to resize a datafile. You are not allowed to add a datafile to a bigfile tablespace.

    Manually reducing the sizes of datafiles enables you to reclaim unused space in the database. This is useful for correcting errors in estimates of space requirements.

    O que eu acho que ocorreu no seu exemplo foi que o espaço minimo alocado para o seu datafile era menor que o espaço definido por padrão na alocação (Extent Mangaement).

    Tente verificar o INITIAL EXTENT dessa tablespace que você criou como exemplo, quanto é?

    Segue o meu exemplo

    sys@ORCL> create tablespace teste_resize datafile '/u02/teste_resize.dbf' size 5m autoextend off;

    Tablespace created.

    sys@ORCL> create table clientes (id varchar2(50),nome varchar2(50)) tablespace teste_resize;

    Table created.

    sys@ORCL> begin
    for r in 1..1000000 loop
    insert into clientes values ('1111111111111111111111111111','222222222222222222222222222');
    commit;
    end loop;
    end;
    /
    2 3 4 5 6 7
    begin
    *
    ERROR at line 1:
    ORA-01653: unable to extend table SYS.CLIENTES by 128 in tablespace TESTE_RESIZE
    ORA-06512: at line 3

    sys@ORCL> sys@ORCL> select count(*) from clientes;

    COUNT(*)

     58032
    

    sys@ORCL> drop table clientes purge;

    Table dropped.

    sys@ORCL> select file_name from dba_data_files where tablespace_name = 'TESTE_RESIZE';

    FILE_NAME

    /u02/teste_resize.dbf

    sys@ORCL> alter database datafile '/u02/teste_resize.dbf' resize 1m;

    Database altered.

    sys@ORCL> select tablespace_name, bytes/1024/1024 from dba_data_files where tablespace_name = 'TESTE_RESIZE';

    TABLESPACE_NAME BYTES/1024/1024


    TESTE_RESIZE 1

    sys@ORCL> select tablespace_name, initial_extent from dba_tablespaces where tablespace_name='TESTE_RESIZE';

    TABLESPACE_NAME INITIAL_EXTENT


    TESTE_RESIZE 65536

    Atenciosamente,
    Felipe.