sqlplus scott/tiger@orcl comp.sql >> comp.log
Within the comp.sql, I will start with the following commands:
SET TIMING ON
SET SERVEROUTPUT ON SIZE 1000000
SET SERVEROUTPUT ON SIZE 1000000
I usually like to declare at least one date variables:
vdate DATE;
After the Begin, I like to place the following command:
DBMS_OUTPUT.DISABLE;
DBMS_OUTPUT.ENABLE(1000000);
vdate := SYSDATE;DBMS_OUTPUT.ENABLE(1000000);
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI'));
Towards the end, I like to know how long the script runs by adding the following command:
DBMS_OUTPUT.PUT_LINE('Elapse time is ' || ((sysdate-vdate)*24*60) ||' minutes');
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI'));
So the script would look something like this:
SET TIMING ON
SET SERVEROUTPUT ON SIZE 1000000
SET SERVEROUTPUT ON SIZE 1000000
Declare
vdate DATE;
.........
Begin
DBMS_OUTPUT.DISABLE;
DBMS_OUTPUT.ENABLE(1000000);
DBMS_OUTPUT.ENABLE(1000000);
vdate := SYSDATE;
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI'));
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI'));
.........
DBMS_OUTPUT.PUT_LINE('Elapse time is ' || ((sysdate-vdate)*24*60) ||' minutes');
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI'));
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI'));
/
No comments:
Post a Comment