由於我是antscript和sql/oracle的新手,因此我無法理解我所擁有的日誌。因此,請您通過查看代碼我應該移動哪個方向。這個連接沒有建立或者是另一個問題。 在build.xml運行Ant腳本定義如下通過ant腳本運行SQLQuery,但它不創建表
<?xml version="1.0"?>
<project name="Hello World Project" default="myTarget">
<target name="myTarget">
<!-- directory where db scritps reside -->
<property name="oracle.scriptPath" value="D:\\ganganshu" />
<!-- path of tnsnames.org file -->
<property name="oracle.tns_alias" value="wind" />
<!-- Oracle user name -->
<property name="oracle.user_name" value="system" />
<!-- Oracle Password -->
<property name="oracle.password" value="manager" />
<!-- login.sql should have sqlcode exit so failonerror will fail build -->
<exec executable="sqlplus" failonerror="true">
<arg value="${oracle.user_name}/${oracle.password}@${tns_alias}"/>
<arg value="@${oracle.scriptPath}\\SILO1_schema_script.sql"/>
</exec>
</target>
</project>
and my sql script file is defined below
DROP TABLESPACE SILO2 INCLUDING CONTENTS CASCADE CONSTRAINTS;
DROP USER SILO2;
CREATE TABLESPACE SILO2 DATAFILE 'D:\PTC\WINDCHILL_10.2\OCU\ORADATA\WIND\SILO2.DBF' SIZE 8388608 AUTOEXTEND ON NEXT 131072 MAXSIZE 32767M LOGGING ONLINE PERMANENT BLOCKSIZE 8192 EXTENT MANAGEMENT LOCAL AUTOALLOCATE DEFAULT NOCOMPRESS SEGMENT SPACE MANAGEMENT AUTO;
/* USER SQL */
CREATE USER SILO2 IDENTIFIED BY SILO2 DEFAULT TABLESPACE "SILO2" TEMPORARY TABLESPACE "TEMP";
but when i try to run the ant file I am getting this in the command prompt and the
scheama is not getting created
[exec]
[exec] SQL*Plus: Release 11.2.0.1.0 Production on Mon Dec 16 11:00:32 2013
[exec]
[exec] Copyright (c) 1982, 2010, Oracle. All rights reserved.
[exec]
[exec] ERROR:
[exec] ORA-12541: TNS:no listener
[exec]
[exec]
[exec] Enter user-name:
和我的tnsnames.ora包含此
# TNSNAMES.ORA Network Configuration File: D:\temp\OSA92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
wind =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = renault-dev.ptcnet.ptc.com)(PORT = 1521))
)
(CONNECT_DATA =
(SID = wind)
)
)
and I have set tns_alias as a property in build.xml only and not anywhere else
你似乎沒有定義'tnsalias'變量。您也可以嘗試使用'-v'選項來獲取更多信息。 – GregHNZ