我需要拆分一个Oracle SQL脚本
我需要通过将Oracle SQL文件拆分为两个文件来修改它,但我对Oracle没有任何经验。以下是我现在拥有的: linkload.bat我需要拆分一个Oracle SQL脚本,oracle,sqlplus,Oracle,Sqlplus,我需要通过将Oracle SQL文件拆分为两个文件来修改它,但我对Oracle没有任何经验。以下是我现在拥有的: linkload.bat SQLPLUSW /nolog @linkload.txt CONNECT ABC/abcnumber1s2@defghi2; spool E:\DataLoad\MovDataProductionJob\updclust.log; select systimestamp start_time from dual; @E:\DataUpd\UpdCl
SQLPLUSW /nolog @linkload.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;
SQLPLUSW /nolog @linkload1.txt
SQLPLUSW /nolog @linkload2.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;
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;
linkload.txt
SQLPLUSW /nolog @linkload.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;
SQLPLUSW /nolog @linkload1.txt
SQLPLUSW /nolog @linkload2.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;
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;
我需要拆分linkload.txt,以便第一个文件包含@E:\DataUpd\UpdClust.sql
行之前的功能,第二个文件包含之后的所有功能。我意识到这并不像把文件拆开那么简单,而且在我无法控制的情况下,我无法访问SQLDeveloper,甚至无法在开发服务器上进行尝试。这就是我把它带到StackOverflow的原因
以下是我的想法:
linkload.bat
SQLPLUSW /nolog @linkload.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;
SQLPLUSW /nolog @linkload1.txt
SQLPLUSW /nolog @linkload2.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;
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;
linkload1.txt
SQLPLUSW /nolog @linkload.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;
SQLPLUSW /nolog @linkload1.txt
SQLPLUSW /nolog @linkload2.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;
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;
linkload2.txt
SQLPLUSW /nolog @linkload.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;
SQLPLUSW /nolog @linkload1.txt
SQLPLUSW /nolog @linkload2.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;
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
命令,以及它是否需要在两个文件中。就像我之前说过的,在它进入登台环境之前,我真的没有办法测试它。任何反馈都将不胜感激。您还需要第二个脚本中的spool命令,因为这就是告诉sqlplus将选择的输出保存到文件中的原因。但是第二个脚本中的spool命令将需要APPEND参数,否则它将覆盖第一个文件的输出。第二个脚本中也需要spool命令,因为这就是告诉sqlplus将选择的输出保存到文件的原因。但是第二个脚本中的spool命令将需要APPEND参数,否则它将覆盖第一个文件的输出。谢谢。我做出了改变,这似乎是有道理的。我已经将它发送给了组织中的一位DBA,以便在我们的暂存数据库上执行。@Joe,我相信这是有效的。如果你想根据你的评论提交答案,我将投票并将其标记为接受;很高兴它对你有用。