Command-Line
The migrator can be run from the command line by running "java -jar sundog.database.migrator.jar" and passing the following parameters:
| -classpath | The classpath that includes where the changelog files are located (can include packaged .ear and .war files) |
| -driver | The database driver to use (i.e. oracle.jdbc.OracleDriver). The driver class must be in the system classpath or the path specified by the -classpath arguement |
| -dropAllFirst | Drops all database objects before migrating the database. Useful for refreshing a development database |
| -execute | Runs all the statements against the databaset |
| -migrationFile | Migration file and location in the classpath using standard java package notation (com/example/db.changelog.xml) |
| -outputChangelogSQL | Don't actually run the statements, instead save the databasechangelog insert statements to a file. Useful for fixing out-of-sync a changelog table |
| -outputSQL | Don't actually run the statements, instead save the databasechangelog insert statements and change SQL to a text file. Useful for allowing DBA sign-off before applying changes |
| -password | Database Password |
| -url | Database URL |
| -username | Username |
| -listLocks | Don't attempt to migrate the database, simply list what machines have a lock on the change log table |
| -releaseLocks | Don't attempt to migrate the database, clear out any locks machines have on the change log table (only use if you KNOW the lock should have been released) |
Examples:
java -jar sundog.database.migrator.jar -driver oracle.jdbc.OracleDriver -classpath \path\to\classes:jdbcdriver.jar -execute -migrationFile com/example/db.changelog.xml -url "jdbc:oracle:thin:@localhost:1521:oracle" -username scott -password tiger
java -jar sundog.database.migrator.jar -driver oracle.jdbc.OracleDriver -classpath website.war -execute -migrationFile com/example/db.changelog.xml -url jdbc:oracle:thin:@localhost:1521:oracle -username scott -password tiger
java -jar sundog.database.migrator.jar -driver oracle.jdbc.OracleDriver -classpath application.ear -execute -migrationFile com/example/db.changelog.xml -url jdbc:oracle:thin:@localhost:1521:oracle -username scott -password tiger
java -jar sundog.database.migrator.jar -driver oracle.jdbc.OracleDriver -classpath jdbcdriver.jar -url jdbc:oracle:thin:@localhost:1521:oracle -username scott -password tiger -listLocks