Contribute to the DSpace Development Fund

The newly established DSpace Development Fund supports the development of new features prioritized by DSpace Governance. For a list of planned features see the fund wiki page.

This command can be used at any time to manage or upgrade the Database. It will also assist in troubleshooting PostgreSQL and Oracle connection issues with the database.

Command used:

[dspace]/bin/dspace database

Java class:

org.dspace.storage.rdbms.DatabaseUtils

Valid Arguments:

Description

testTest the database connection settings (in [dspace]/config/dspace.cfg or local.cfg) are OK and working properly.  This command also validates the database version is compatible with DSpace.
info

Provide detailed information about the DSpace database itself. This includes the database type, version, driver, schema, and any successful/failed/pending database migrations.

This command, along with "test", is very useful in debugging issues with your database.

migrate

Migrate the database to the latest version (if not already on the latest version). This uses FlywayDB along with embedded migrations scripts to automatically update your database to the latest version.

Additional 'migrate' options:

  • "migrate ignored" will run a migration which also includes any database migrations which are flagged as "Ignored" (or "Skipped") by the "info" command. If these "Ignored" migrations succeed, they will now be noted (in the "info" command) as having run "Out Of Order" (i.e. they were successful, but they were executed out of the normal, numerical order). 
  • "migrate force" (available in 7.1 and later) will run a migration even when no new migrations exist (i.e. no migrations are currently flagged as "Pending" when using the "info" command). This can be used to force the post-migration ("callback") scripts to run.  Normally, these post-migration scripts only run after a new migrations are applied. They will (re-)initialize your database with required objects, like the "Site" object, default groups (Administrator/Anonymous) and default metadata registry and bitstream format registry entries.
repair

Attempt to "repair" any migrations which are flagged as "Failed" by the "info" command and/or resolve failed checksum validation. This runs the FlywayDB repair command.

Please note however, this will NOT automatically repair corrupt or broken data in your database. It merely tries to re-run previously "Failed" migrations and/or realign the checksums of the applied migrations to the ones of the available migrations.

skip

(Available in 7.5 and later) Allows you to "skip" individual database migrations. Skipping a migration will flag it as having run successfully (either "Success" or "Out of Order" status), but the migration will not be executed.

WARNING: You should ONLY skip migrations which are no longer required or have become obsolete. Skipping a REQUIRED migration may result in DSpace failing to startup or function properly.  The only fix to that scenario would be to run the migration manually (by executing the SQL directly on the database).  Therefore, this "skip" command should ONLY be used when the migration is known to be obsolete or no longer valid.  All other usages are unsupported.

update-sequences

Update database sequences after running a bulk ingest (e.g. AIP Backup and Restore) or data migration.

validateValidate the checksums of all previously run database migrations. This runs the FlywayDB 'validate' command.
clean

Completely and permanently delete all tables and data in this database. WARNING: There is no turning back! If you run this command, you will lose your entire database and all its contents.

This command is only useful for testing or for reverting your database to a "fresh install" state (e.g. running "dspace database clean" followed by "dspace database migrate" will return your database to a fresh install state)

By default the 'clean' command is disabled (to avoid accidental data loss). In order to enable it, you must first set db.cleanDisabled=false in either your local.cfg or dspace.cfg.

  • No labels