Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORA-65040 error when trying to clean different schema with system user #1109

hamiller opened this issue Oct 20, 2015 · 6 comments


Copy link

A simple "flyway clean" leads to an error ORA-65040 when trying to execute it against a Oracle 12c database - both on linux.

Database Version:

Oracle Database 12c Enterprise Edition Release - 64bit Production
PL/SQL Release - Production
"CORE  Production"
TNS for Linux: Version - Production
NLSRTL Version - Production

Output Log:

./flyway -X clean

Flyway 3.2.1 by Boxfuse

DEBUG: Unable to load config file: xxx/flyway-3.2.1/conf/
DEBUG: Loading config file: xxx/flyway-3.2.1/conf/flyway.conf
DEBUG: Unable to load config file: /home/yyy/flyway.conf
DEBUG: Unable to load config file: xxx/flyway-3.2.1/flyway.conf
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/derby-
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/jna-3.3.0.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/ojdbc6.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/h2-1.3.170.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/postgresql-9.3-1102-jdbc4.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/hsqldb-2.3.2.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/jna-3.3.0-platform.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/mariadb-java-client-1.1.7.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/derbyclient-
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/sqlite-jdbc-3.7.15-M1.jar
DEBUG: Adding location to classpath: xxx/flyway-3.2.1/drivers/jtds-1.3.1.jar
Database: jdbc:oracle:thin:@//localhost:1521/icsora (Oracle 12.1)
DEBUG: DDL Transactions Supported: false
DEBUG: Scanning for filesystem resources at 'xxx/flyway-3.2.1/sql' (Prefix: '', Suffix: '.sql')
DEBUG: Scanning for resources in path: xxx/flyway-3.2.1/sql (xxx/flyway-3.2.1/sql)
DEBUG: Filtering out resource: xxx/flyway-3.2.1/sql/put-your-sql-migrations-here.txt (filename: put-your-sql-migrations-here.txt)
DEBUG: Cleaning schema "ICSNT" ...
DEBUG: Rolling back transaction...
DEBUG: Transaction rolled back
ERROR: Unexpected error
org.flywaydb.core.api.FlywayException: Unable to clean schema "ICSNT"
    at org.flywaydb.core.internal.dbsupport.Schema.clean(
    at org.flywaydb.core.internal.command.DbClean$4.doInTransaction(
    at org.flywaydb.core.internal.command.DbClean$4.doInTransaction(
    at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(
    at org.flywaydb.core.internal.command.DbClean.cleanSchema(
    at org.flywaydb.core.internal.command.DbClean.clean(
    at org.flywaydb.core.Flyway$3.execute(
    at org.flywaydb.core.Flyway$3.execute(
    at org.flywaydb.core.Flyway.execute(
    at org.flywaydb.core.Flyway.clean(
    at org.flywaydb.commandline.Main.executeOperation(
    at org.flywaydb.commandline.Main.main(
Caused by: java.sql.SQLException: ORA-65040: Vorgang ist innerhalb einer integrierbaren Datenbank nicht zulässig
ORA-06512: in "SYS.DBMS_AQADM", Zeile 388
ORA-06512: in Zeile 1

    at oracle.jdbc.driver.T4CTTIoer.processError(
    at oracle.jdbc.driver.T4CTTIoer.processError(
    at oracle.jdbc.driver.T4C8Oall.processError(
    at oracle.jdbc.driver.T4CTTIfun.receive(
    at oracle.jdbc.driver.T4CTTIfun.doRPC(
    at oracle.jdbc.driver.T4C8Oall.doOALL(
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(
    at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(
    at oracle.jdbc.driver.OraclePreparedStatement.execute(
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(
    at org.flywaydb.core.internal.dbsupport.JdbcTemplate.execute(
    at org.flywaydb.core.internal.dbsupport.Schema.clean(
    ... 11 more

Copy link

Your user has queue tables. You need to GRANT EXECUTE ON DBMS_AQADM TO <youruser> for Flyway to be able to clean them. I've improved the error output to make this clearer.

Copy link

hamiller commented Nov 2, 2015

I don't think this is correct: I'm trying to get rid of the schema as the system user.
Nevertheless, granting the privilege to the schema user doesn't resolve the problem either.

Copy link

Please post your full Flyway config so we can clear this up.

Copy link

hamiller commented Nov 2, 2015


Copy link

hamiller commented Nov 2, 2015

the config is working fine if I don't clean the schema befor (migrating works)

@axelfontaine axelfontaine reopened this Nov 2, 2015
@axelfontaine axelfontaine added this to the Flyway 4.0 milestone Nov 2, 2015
@axelfontaine axelfontaine changed the title ORA-65040 error when trying to flyway-clean with Oracle 12c ORA-65040 error when trying to clean different schema with system user Dec 29, 2015
axelfontaine pushed a commit to flyway/ that referenced this issue Dec 29, 2015
Copy link

Should be fixed now. Please test the latest code to make sure your case is fully covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants