Le comparto este script para saber que tablas tienen mas de n cantidad de registros, les puede servir para identificar donde crear índices o el orden en los querys para optimizar uso de índices, se ejecuta como scripts para mejor resultado.

DECLARE
 x NUMBER;
 stmt VARCHAR2(200);

 cursor c_tablas is
    select table_name
      from cat
    where table_type = 'TABLE';
      --and table_name = 'TMP_TIPO_MOVIMIENTOS';

 v_tablas c_tablas%rowtype;

BEGIN

   FOR v_tablas IN c_tablas
   LOOP   
    stmt := 'select count(*) from '||v_tablas.table_name;
    --DBMS_OUTPUT.PUT_LINE(stmt);
    execute immediate stmt into x;
    if x > 10000 then
      DBMS_OUTPUT.PUT_LINE(x||' '||v_tablas.table_name);
    end if;
   END LOOP; 
 END;

nota: se ve el dato en el visor de dbms en SQLDeveloper en toad se tiene que activar dbms output.

asked 26 Aug '14, 01:00

Jaime%20Menjivar's gravatar image

Jaime Menjivar
(suspended)
accept rate: 16%

edited 26 Aug '14, 21:31

Fernando%20Paz's gravatar image

Fernando Paz ♦♦
17.3k81635


Gracias Jaime

link

answered 26 Aug '14, 21:31

Fernando%20Paz's gravatar image

Fernando Paz ♦♦
17.3k81635
accept rate: 51%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Evolution en BitBucket

En este sitio puede acceder al código fuente, centro de descargas y reportar bugs, propuestas y mejoras para Evolution.

Evolution en JIRA

En este sitio puedes sugerir nueva funcionalidad para Evolution, o puedes votar por la funcionalidad ya propuesta por otros usuarios.

Tags:

×34
×1
×1
×1

Asked: 26 Aug '14, 01:00

Seen: 6,103 times

Last updated: 26 Aug '14, 21:31

[Acerca de] [Preguntas Frecuentes] [Privacidad] [Soporte] [Contacto]
Copyright 2013-2018. Asesores en Informática