oracle-databasemavenflywaysysdba

How do I migrate DB as SYSDBA in Maven Flyway Plugin?


I am using the Maven Flyway plugin to migrate a database in Oracle. Unfortunately, in the flyway:clean phase for Schema1, the synonym I created for Schema1 to Schema2 is lost.

The workaround I considered is migrating the database as user "sys" and with the role "SYSDBA" so that I can run a create synonym script each time I migrate.

The problem is that the Flyway plugin does not give any option in the POM to specify the role. Are there any workarounds for this, or the synonym being lost in the clean phase?

Best

Anika


Solution

  • To run migrations connected as the 'sys' user with the 'sysdba' role, set the flyway.user property as follows:

    In the maven pom file...

    sys as sysdba

    ...and in the flyway.properties file...

    flyway.user=sys as sysdba

    Quotes are not permissible.