drop table SSI_ETAT;

create table SSI_ETAT (
        table_owner                     varchar2(30),
        table_name                      varchar2(30),
        tablespace_name                 varchar2(30),
        segment_space_management        varchar2(6),
        partitioned                     varchar2(3),
        partition_name                  varchar2(30),
        pct_free                        number,
        avg_row_len                     number,
        last_analyzed                   date,
        chain_cnt                       number,
        blocks                          number,
        avg_space                       number,
        num_rows                        number,
        total_blocks                    number,
        unused_blocks                   number,
        unformatted_blocks              number,
        fs1_blocks                      number,
        fs2_blocks                      number,
        fs3_blocks                      number,
        fs4_blocks                      number,
        full_blocks                     number,
        free_blocks                     number
) tablespace TOOLS;

insert into ssi_etat (table_owner, table_name, tablespace_name, segment_space_management, partitioned, pct_free, last_analyzed)
    select a.owner index_owner,
           a.index_name,
           a.tablespace_name,
           b.segment_space_management,
           a.partitioned,
           a.pct_free,
           a.last_analyzed
    from   dba_indexes a,
           dba_tablespaces b
    where  a.owner = 'CCRARIST'
    and    a.index_name in ('IDX_PER_ID_TFA_LOG','IDX_RESTIT_TRE_LOG_MOT_1')
    and    a.tablespace_name = b.tablespace_name
    and    a.partitioned = 'NO';

commit;
