oracle sqlplus 一小时后返回调用程序,没有任何结果

我有一个 shell 脚本,它调用在后台运行的 sqlplus 连接并在其中执行存储的过程和 sql 查询。每当我们有大量记录要合并时,我们就会调用一个 SP,它依次将一个阶段表合并到一个基表。 合并成功,但 SQLPLUS 在一小时后返回到 shell 脚本,没有任何结果,然后它在下一个查询执行中给出合并 SP 结果,如下面的日志所述。 在下面的例子中,__LV_MERGE_SB_FILE 是 SP sql 文件已在 20210728.01.00.09 24370 开始执行,但在 20210728.02.00.09 24370 整整一个小时后,它已返回到 shell 脚本。然后当 TS_SQL 文件开始执行时,它已经将 Merge SP 的结果给了它。

#SQLPLUS in back ground:
sqlplus -s $CONNECTION |&
print -p "set heading off;"
print -p "set feedback off;"
print -p "set pagesize 0;"
print -p "set linesize 500;"
print -p "set numwidth 20;"

#function to execute the sql files
function ExecuteSQL
{
    __OUTPUT=""
    print -p @$__LV_IN_SQL_FILE
    print -p "prompt $__EOF"
    while read -p __OUTPUT
    do
        if [[ "$__OUTPUT" == "$__EOF" ]]; then
            break
        else
            print "E3 Failure Check 1: $__OUTPUT"
            echo "$__OUTPUT" >> $__LV_OUT_SQL_FILE
        fi
    done
}

#calling above function like below
ExecuteSQL $__LV_MERGE_SB_FILE $__LV_MERGE_OUT_SB_FILE

#content of sql file in this case merge SP
cat $__LV_MERGE_SB_FILE
var msg_txt varchar2(2000);
var msg_val number;
call SCHEMA.MERGE_SP( 'SGMSTG.STAGE_TABLE','SCM.BASE_TABLE','ROW_NUM',40000,:msg_txt,:msg_val);
print msg_txt;
print msg_val;

#calling function like below
ExecuteSQL $TS_SQL $TS_DAT

#content of file to get timestamp from DB
cat $TS_SQL
select TO_CHAR(systimestamp,'YYYY-MM-DD HH24:MI:SS.FF6') FROM DUAL;

#Logs:
20210728.01.00.09 24370: 12. script.ksh___________Function [ ExecuteSQL ] Started___________
20210728.01.00.09 24370: Executing The SQL File [ __LV_MERGE_SB_FILE ]........
20210728.02.00.09 24370: 12. script.ksh___________Function [ ExecuteSQL ] Completed___________
20210728.02.00.09 24370: 12. script.ksh___________Function [ ExecuteSQL ] Started___________
20210728.02.00.09 24370: Executing The SQL File [ TS_SQL ]........
20210728.02.00.28 24370: E3 Failure Check 1: > Successfully Merged the data from SGMSTG.STAGE_TABLE into SCM.BASE_TABLE
20210728.02.00.28 24370: E3 Failure Check 1: >
20210728.02.00.28 24370: E3 Failure Check 1: > 0
20210728.02.00.28 24370: E3 Failure Check 1: >
20210728.02.00.28 24370: E3 Failure Check 1: > END
20210728.02.00.28 24370: 12. script.ksh___________Function [ ExecuteSQL ] Completed___________
20210728.02.00.28 24370: LOAD END TIME STAMP : Successfully Merged the data from SGMSTG.STAGE_TABLE into SCM.BASE_TABLE 0
20210728.02.00.28 24370: Merge Stored Proc Return Status is :-1

任何帮助都会很棒。提前致谢。

H42801 回答:oracle sqlplus 一小时后返回调用程序,没有任何结果

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/23037.html

大家都在问