jueves, 23 de diciembre de 2010

Comando - Commit_write

Pruebas parámetro commit_write desde Oracle-base

http://www.oracle-base.com/articles/10g/Commit_10gR2.php


create table commit_test (id number, description varchar2(100));

SET SERVEROUTPUT ON
DECLARE
  PROCEDURE do_loop (p_type  IN  VARCHAR2) AS
    l_start  NUMBER;
    l_loops  NUMBER := 10000;
  BEGIN
    EXECUTE IMMEDIATE 'TRUNCATE TABLE commit_test';

    l_start := DBMS_UTILITY.get_time;
    FOR i IN 1 .. l_loops LOOP
      INSERT INTO commit_test (id, description)
      VALUES (i, 'Description for ' || i);
     
      CASE p_type
          WHEN 'NORMAL' THEN COMMIT;
        WHEN 'WAIT' THEN COMMIT WRITE WAIT;
        WHEN 'NOWAIT' THEN COMMIT WRITE NOWAIT;
        WHEN 'BATCH' THEN COMMIT WRITE BATCH NOWAIT;
        WHEN 'IMMEDIATE' THEN COMMIT WRITE IMMEDIATE;
      END CASE;
    END LOOP;
    DBMS_OUTPUT.put_line(RPAD('COMMIT WRITE ' || p_type, 30) || ': ' || (DBMS_UTILITY.get_time - l_start));
  END;
BEGIN
    DO_LOOP('NORMAL');
  --do_loop('WAIT');
  --do_loop('NOWAIT');
  --do_loop('BATCH');
  --do_loop('IMMEDIATE');
END;
/


No hay comentarios:

Publicar un comentario