配置路径
D:dbachangeUATunityschema est
----v0 版本
sql.xml (默认target 是versionfinal ,也就是最终版本)
--versionfinal ,将会执行2条语句 ,一条是01_schema_rollout.sql,第二条 是1.sql
--vesrion1 , 将会执行version 1
<?xml version="1.0" encoding="UTF-8"?> <project name="DBHandler" basedir="." default="versionfinal"> <target name="versionfinal"> <exec executable="cmd.exe"> <arg line="/c sqlplus /nolog @D:dbachangeUATunityschema est 1_schema_rollout.sql"/> </exec> <exec executable="cmd.exe"> <arg line="/c sqlplus /nolog @D:dbachangeUATunityschema est ollout1.sql"/> </exec> </target> <target name="version1"> <exec executable="cmd.exe"> <arg line="/c sqlplus /nolog @D:dbachangeUATunityschema est ollout2.sql"/> </exec> </target> </project>
执行方法:
ant -f sql.xml version1 (只执行version1)
ant -f sql.xml versionfinal (只执行versionfinal)
ant -f sql.xml (默认执行versionfinal)
---v1 版本
<?xml version="1.0" encoding="UTF-8"?> <project name="DBHandler" basedir="." default="versionfinal"> <target name="versionfinal"> <exec executable="cmd.exe"> <arg line="/c cd D:dbachangeUATdbschema2016_TESTdb6.0__datapatch_1"/> <arg line="/c sqlplus /nolog @D:dbachangeUATdbschema2016_TESTdb6.0__datapatch_1 1_schema_change_rollout.sql"/> </exec> </target> <target name="version1"> <exec executable="cmd.exe"> <arg line="/c sqlplus /nolog @D:dbachangeUATdbschema2016_TESTdb6.0_datapatch 1_schema_change_rollout.sql"/> </exec> </target> </project>
---Version 2
<?xml version="1.0" encoding="UTF-8"?> <project name="DBHandler" basedir="." default="versionfinal"> <target name="version2"> <property name="src2" location="D:dbachangeUATdbschema2016_10_18db6.0__datapatch_1"/> <exec dir="${src2}" executable="cmd.exe"> <arg line="/c sqlplus /nolog @D:dbachangeUATdbschema2016_10_18db6.0__datapatch_1 1_schema_change_rollout.sql"/> </exec> </target> <target name="version2_reg"> <property name="src2" location="D:dbachangeUATdbschema2016_10_18db6.0__datapatch_1"/> <exec dir="${src2}" executable="cmd.exe"> <arg line="/c sqlplus /nolog @D:dbachangeUATdbschema2016_10_18db6.0__datapatch_1 1_schema_change_regress.sql"/> </exec> </target> <target name="version1"> <property name="src1" location="D:dbachangeUATdbschema2016_10_18db6.0_datapatch"/> <exec dir="${src1}" executable="cmd.exe"> <arg line="/c sqlplus /nolog @D:dbachangeUATdbschema2016_10_18db6.0_datapatch 1_schema_change_rollout.sql"/> </exec> </target> </project>
--v3 版本
<?xml version="1.0" encoding="UTF-8"?> <project name="DBHandler" basedir="." default="versionfinal"> <target name="version2"> <property name="src2" location=".EPP6.0__datapatch_1"/> <exec dir="${src2}" executable="cmd.exe"> <arg line="/c sqlplus /nolog @. 1_schema_change_rollout.sql"/> </exec> </target> <target name="version2_reg"> <property name="src2" location=".EPP6.0__datapatch_1"/> <exec dir="${src2}" executable="cmd.exe"> <arg line="/c sqlplus /nolog @.EPP6.0__datapatch_1 1_schema_change_regress.sql"/> </exec> </target> <target name="version1"> <property name="src1" location=".epp6.0_datapatch"/> <exec dir="${src1}" executable="cmd.exe"> <arg line="/c sqlplus /nolog @. 1_schema_change_rollout.sql"/> </exec> </target> </project>
01_schema_rollout.sql
pause
disconn
调整为
begin
DBMS_LOCK.SLEEP(20);
end;
/