ant 配置 和测试 1

 

配置路径

D:\dba\change\UAT\unity\schema\test

 

 ----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:\dba\change\UAT\unity\schema\test\01_schema_rollout.sql"/>
</exec>
<exec executable="cmd.exe">
  <arg line="/c sqlplus /nolog @D:\dba\change\UAT\unity\schema\test\rollout\1.sql"/>
</exec>
</target>

<target name="version1">
<exec executable="cmd.exe">
  <arg line="/c sqlplus /nolog @D:\dba\change\UAT\unity\schema\test\rollout\2.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:\dba\change\UAT\db\schema\2016_TEST\db6.0__datapatch_1\"/>
  <arg line="/c sqlplus /nolog @D:\dba\change\UAT\db\schema\2016_TEST\db6.0__datapatch_1\01_schema_change_rollout.sql"/>
</exec>
</target>

<target name="version1">
<exec executable="cmd.exe">
  <arg line="/c sqlplus /nolog @D:\dba\change\UAT\db\schema\2016_TEST\db6.0_datapatch\01_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:\dba\change\UAT\db\schema\2016_10_18\db6.0__datapatch_1"/>
 <exec dir="${src2}"  executable="cmd.exe">
  <arg line="/c sqlplus /nolog @D:\dba\change\UAT\db\schema\2016_10_18\db6.0__datapatch_1\01_schema_change_rollout.sql"/>
</exec>
</target>

 <target name="version2_reg">
 <property name="src2" location="D:\dba\change\UAT\db\schema\2016_10_18\db6.0__datapatch_1"/>
 <exec dir="${src2}"  executable="cmd.exe">
  <arg line="/c sqlplus /nolog @D:\dba\change\UAT\db\schema\2016_10_18\db6.0__datapatch_1\01_schema_change_regress.sql"/>
</exec>
</target>


<target name="version1">
 <property name="src1" location="D:\dba\change\UAT\db\schema\2016_10_18\db6.0_datapatch"/>
 <exec dir="${src1}"  executable="cmd.exe">
  <arg line="/c sqlplus /nolog @D:\dba\change\UAT\db\schema\2016_10_18\db6.0_datapatch\01_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 @.\01_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\01_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 @.\01_schema_change_rollout.sql"/>  
</exec>

</target>


</project>

 

01_schema_rollout.sql

 

pause
disconn

调整为

begin
DBMS_LOCK.SLEEP(20);
end;
/

posted @ 2016-11-25 15:03  feiyun8616  阅读(263)  评论(0编辑  收藏  举报