I have debugged my PL/SQL with dbms_output.put_line statements and
how that the job is moving into production I need to know where the
output would be written. I know that the put_line
statements are not written anywhere when the PL/SQL is inside a
scheduled job. Does leaving the dbms_output.put_line
statements cause overhead in a production shell script job? Also,
how can I display the output of my dbms_output.put_line
when running the code within a batch job using dbms_scheduler?
Answer: Normally, people
change from dbms_output to utl_file for batch jobs,
but that is not required.
Even if a
dbms_output.put_line writes to /dev/null, the statements
still add overhead . . . .
When I move code into production, I comment out the
dbms_output statements and leave them in the code, in case
I ever need to debug it!
put_line works with SQL*Plus when you "set serveroutput
If the job is a UNIX/Linux shell script or a
dbms_scheduler job, you can try using the spool command,
since the PL/SQL is executed via a call to SQL*Plus.
Jon Emmons has lots of working examples in his book "Oracle
Below, we directly spool the output within the PL/SQL, provided that
you invoke the PL/SQL via a call to SQL*Plus:
# First, we must set the environment . . . .
/etc/oratab|grep ^$ORACLE_SID:|cut -f2 -d':'`
. . .
Get the Complete
Oracle SQL Tuning Information
The landmark book
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
for 30% off directly from the publisher.