How to Generate Result from Script Files to Oracle Spool File

时间:2018-12-19 11:34:12

标签: oracle sqlplus oracle11gr2

I have a script file containing a mix of DDL and DML which rebuilds a database I use for testing against. The script file is generating some errors which I need to track down so I attempted to output the results of the script to a spool file using SQLPlus, see below:

spool "c:\DBDeploy\ALERTSTLOCAL_Version4x_Rebuild.spl";
@"c:\DBDeploy\ALERTSTLOCAL_Version4x_Rebuild.sql";
spool off;

Unfortunately although the spool file gets generated none of the results from the script file (apart from the 'spool off' statement ), get written to the spool file. Can anyone suggest what is happening here. I am sure I have used this technique in bygone years, its most perplexing :-/

Kind Regards Paul J.

1 个答案:

答案 0 :(得分:0)

您需要一些调整

SET SERVEROUTPUT ON FORMAT WRAPPED
SET VERIFY OFF
SET FEEDBACK OFF
SET TERMOUT OFF

DBMS_OUTPUT.ENABLE(1000000);

spool "c:\DBDeploy\ALERTSTLOCAL_Version4x_Rebuild.spl";
@"c:\DBDeploy\ALERTSTLOCAL_Version4x_Rebuild.sql";
spool off;

SET TERMOUT ON
SET FEEDBACK ON
SET VERIFY ON

经过测试的屏幕截图:

enter image description here

在Windows上

enter image description here