在sql-maven-plugin执行期间如何修复ORA-00604和ORA-12705?

时间:2017-04-08 14:16:20

标签: java oracle maven nls-lang

我试图通过maven插件在oracle中删除表空间。这是配置:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>sql-maven-plugin</artifactId>
    <version>1.5</version>
    <dependencies>
        <dependency>
            <groupId>oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
    <configuration>
        <driver>oracle.jdbc.driver.OracleDriver</driver>
        <url>jdbc:oracle:thin:@localhost:1521:XE</url>
        <username>system</username>
        <password>1</password>
    </configuration>
    <executions>
        <execution>
            <id>drop</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>execute</goal>
            </goals>
            <configuration>
                <autocommit>true</autocommit>
                <sqlCommand>DROP TABLESPACE myTableSpace INCLUDING CONTENTS and DATAFILES;</sqlCommand>
                <onError>continue</onError>
            </configuration>
        </execution>
    <executions>
<plugin

这会导致以下错误:

[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (drop) on project database-migration: ORA-00604: error occurred at recursive SQL level 1
[ERROR] ORA-12705: Cannot access NLS data files or invalid environment specified

我已经google了,并尝试通过maven插件设置NLS_LANG:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0.0</version>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>set-system-properties</goal>
            </goals>
            <configuration>
                <properties>
                    <property>
                        <name>NLS_LANG</name>
                        <value>AMERICAN_AMERICA.UTF8</value>
                    </property>
                </properties>
            </configuration>
        </execution>
    </executions>
</plugin>

命令行(windows):

SET NLS_LANG=AMERICAN_AMERICA.UTF8
echo %NLS_LANG%
AMERICAN_AMERICA.UTF8    

但得到同样的错误。

另请注意,使用Intellij Idea我有相同的连接设置和相同的用户/通行证,可以删除此表空间而不会出现任何错误。

为什么我不能通过maven这样做?如何解决这个问题?

0 个答案:

没有答案