0
我需要通过将Oracle SQL文件拆分为两个文件来修改Oracle SQL文件,但我对Oracle没有经验。这是我现在有:我需要拆分Oracle SQL脚本
linkload.bat
SQLPLUSW /nolog @linkload.txt
linkload.txt
CONNECT ABC/[email protected];
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。
这就是我想出了:
linkload.bat
SQLPLUSW /nolog @linkload1.txt
SQLPLUSW /nolog @linkload2.txt
linkload1.txt
CONNECT ABC/[email protected];
spool E:\DataLoad\MovDataProductionJob\updclust.log;
select systimestamp start_time from dual;
@E:\DataUpd\UpdClust.sql
--spool off;
disconnect;
exit;
linkload2.txt
CONNECT ABC/[email protected];
-- 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
命令,如果它需要在两个文件中。就像我之前说过的,在进入临时环境之前,我没有办法测试它。对于任何反馈,我们都表示感谢。
您还需要在第二个脚本中使用spool命令,因为这就是告诉sqlplus将SELECT的输出保存到文件。但第二个脚本中的spool命令将需要APPEND参数,否则它将覆盖第一个文件的输出。 – Joe
谢谢。我做了改变,这似乎是有道理的。我已将其发送给我的组织中的DBA,以在我们的临时数据库上执行。 –
@Joe,我相信这是有效的。如果您想根据您的评论提交答案,我会立即投票并将其标记为已接受。 –