Pular para o conteúdo
Visualizando 6 posts - 1 até 6 (de 6 do total)
  • Autor
    Posts
  • #88577
    ramasine
    Participante

      Caros,

      Há forma de se fazer um truncate em uma tabela e não mexer nas estatísticas ? OU seja, elas mesmo assim se manterem atualizadas, com a última fotografia desta tabela?

      Abs

      Marcelo

      #88578
      ramasine
      Participante

        Já achei alguma coisa!

        dbms_stats.lock_table_stats

        Abs

        Mr

        #88581
        vieri
        Participante

          Quando vc faz um truncate, as estatisticas da tabela continuam as mesmas.

          Ela so é atualizada após uma nova coleta:

          SQL> select table_name , num_rows , owner from dba_tables where TABLE_NAME = ‘INT_E_AGENDA_RECEBIMENTO’ ;

          TABLE_NAME NUM_ROWS OWNER


          INT_E_AGENDA_RECEBIMENTO 80 WIS40P

          SQL> truncate table WIS40P.INT_E_AGENDA_RECEBIMENTO ;

          Table truncated.

          SQL> select table_name , num_rows , owner from dba_tables where TABLE_NAME = ‘INT_E_AGENDA_RECEBIMENTO’ ;

          TABLE_NAME NUM_ROWS OWNER


          INT_E_AGENDA_RECEBIMENTO 80 WIS40P

          SQL> analyze table WIS40P.INT_E_AGENDA_RECEBIMENTO estimate statistics ;

          Table analyzed.

          SQL> select table_name , num_rows , owner from dba_tables where TABLE_NAME = ‘INT_E_AGENDA_RECEBIMENTO’ ;

          TABLE_NAME NUM_ROWS OWNER


          INT_E_AGENDA_RECEBIMENTO 0 WIS40P

          sacas ?

          #88584
          ramasine
          Participante

            Com o DELETE tb funcionaria?

            Abs!!

            #88585
            ramasine
            Participante

              O que queria é que mesmo após o TRUNCATE…após novas coletas automáticas, algumas tabelas não tivesses as mesmas atualizadas!

              Abs

              Marcelo

              #88587
              vieri
              Participante

                Provavelmente vc coleta a estátistica com algum script dinâmico correto?

                ou vc faz um “defaultzão” por owner ou database?

                Use esse carinha aqui e coloque as tabelas que não deseja coletar
                incluso no not in.

                set term off feedback off verify off pages 0 lines 500 trimspool on head off
                spool /home/oracle/scripts/gera_analize_full.sql
                select ‘execute sys.dbms_stats.gather_table_stats(ownname=>’
                || chr(39) || owner || chr(39) || ‘,tabname=>’
                || chr(39) || table_name
                || chr(39) || ‘,granularity=>’
                || chr(39) || ‘ALL’
                || chr(39) || ‘,method_opt=>’
                || chr(39) || ‘FOR ALL COLUMNS SIZE 1’ || chr(39)
                || ‘, estimate_percent=>null,cascade=>TRUE, DEGREE=>6);’
                from dba_tables
                where temporary ‘Y’
                and tablespace_name not in (‘SYSTEM’,’SYSAUX’,’TOOLS’)
                and owner not in (‘SYSTEM’,’TOAD’,’PERFSTAT’,’SGEP’)
                and table_name not in (‘INCLUI AQUI SUAS TABELAS’)
                order by owner,table_name
                /
                spool off
                set feed on
                spool /home/oracle/scripts/saida_analize_full.lst
                @/home/oracle/scripts/gera_analize_full.sql
                spool off

              Visualizando 6 posts - 1 até 6 (de 6 do total)
              • Você deve fazer login para responder a este tópico.