PLSQL在日志文件中写入

时间:2017-07-27 05:15:10

标签: logging plsql ksh

我有以下ksh,test.ksh,它调用sql脚本:

sqlplus user/passwrd @testChange.sql

我的testChange.sql如下:

spool testChange.log
SET serveroutput ON;
SET linesize 350;
ALTER SESSION SET nls_date_format='dd/mm/yyyy hh24:mi:ss';
DECLARE

  nbCharAlterer NUMBER;
BEGIN

  nbCharAlterer:= 3;
  USER.PKG_TEST_CHANGE.ALTER (  nbCharAlterer => nbCharAlterer) ;
END;
/
spool off;
exit;

我的包裹的头部如下:

create or replace package PKG_TEST_CHANGE AUTHID CURRENT_USER is
  nbCharAlterer number:=3;   
  TYPE t_array IS TABLE OF VARCHAR2(50)    INDEX BY BINARY_INTEGER; 
  procedure alterer(nbCharAlterer in number );   
end PKG_TEST_CHANGE;

我的包裹正文如下:

create or replace package body PKG_TEST_CHANGE as

compteur PLS_INTEGER      := 0;
nbCharAlterer PLS_INTEGER   := 3;
nbParallel PLS_INTEGER       := 8

PROCEDURE ALTER(
        nbCharAlterer IN NUMBER)
IS

CURSOR SQL_TABLE     IS
    SELECT TABLE_OWNER,TABLE_NAME,COLUMN_NAME,TYPE,SEPARATE,PATTERN,ID FROM 

ALTERE_PARAM ;

  sTable                                  sys.ALL_TAB_COLUMNS.table_name%TYPE;
  sOwner                                  sys.ALL_TAB_COLUMNS.owner%TYPE;
  sColumn                                 sys.ALL_TAB_COLUMNS.COLUMN_NAME%TYPE;
  sType                                 sys.ALL_TAB_COLUMNS.COLUMN_NAME%TYPE;
  sPattern                                 ALTERE_PARAM.PATTERN%TYPE;
  sSeparator                                 ALTERE_PARAM.SEPARATE%TYPE;
  sId                                 sys.ALL_TAB_COLUMNS.COLUMN_NAME%TYPE;

  nNbTable number;


BEGIN
dbms_output.put_line('   ' ||TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI')||' => Database changing');
DBMS_APPLICATION_INFO.SET_CLIENT_INFO('Alter');

....Some code

END ALTER;

end PKG_TEST_CHANGE;

我希望将dbms_output.put_line('')记录在日志文件中。我按照以下方式运行了我的ksh:

nohup ./test.ksh > alterTest.log &

我的日志文件只有一行'会话已更改。'。知道为什么我的日志没有以正确的方式工作吗?我正在使用Oracle 10g。

0 个答案:

没有答案