0

我需要通过将 Oracle SQL 文件拆分为两个文件来修改它,但我对 Oracle 的经验为零。这是我现在拥有的:

链接加载.bat

SQLPLUSW /nolog @linkload.txt

链接加载.txt

CONNECT ABC/abcnumber1s2@defghi2;

spool E:\DataLoad\MovDataProductionJob\updclust.log;

select systimestamp start_time from dual;

@E:\DataUpd\UpdClust.sql

-- call load_schedule();

select systimestamp updclust_end_time from dual;

----comment/ uncomment following for disabling/ enabling load or schedule load depends on count

 call load_schedule_10G();

select systimestamp end_time from dual;

--spool off;

disconnect;

exit;

我需要拆分 linkload.txt 以便第一个文件包含直到并包括该@E:\DataUpd\UpdClust.sql行的功能,第二个文件包含之后的所有功能。我意识到这并不像将文件分开那么简单,而且由于我无法控制的情况,我无法访问 SQLDeveloper 甚至无法使用开发服务器来尝试此操作。所以这就是我将它带到 StackOverflow 的原因。

这是我想出的:

链接加载.bat

SQLPLUSW /nolog @linkload1.txt
SQLPLUSW /nolog @linkload2.txt

链接加载1.txt

CONNECT ABC/abcnumber1s2@defghi2;

spool E:\DataLoad\MovDataProductionJob\updclust.log;

select systimestamp start_time from dual;

@E:\DataUpd\UpdClust.sql

--spool off;

disconnect;

exit;

链接加载2.txt

CONNECT ABC/abcnumber1s2@defghi2;

-- call load_schedule();

select systimestamp updclust_end_time from dual;

----comment/ uncomment following for disabling/ enabling load or schedule load depends on count

call load_schedule_10G();

select systimestamp end_time from dual;

disconnect;

exit;

这看起来正确吗?我最不确定的想法是spool命令以及它是否需要在两个文件中。就像我之前说的,在它进入暂存环境之前,我真的没有办法对其进行测试。对于任何反馈,我们都表示感谢。

4

1 回答 1

1

您还需要在第二个脚本中使用 spool 命令,因为这就是告诉 sqlplus 将 SELECT 的输出保存到文件的原因。但是第二个脚本中的 spool 命令需要 APPEND 参数,否则它将覆盖第一个文件的输出。

于 2013-10-25T17:47:12.370 回答