All Versions
- DSpace 7.x (Current Release)
- DSpace 8.x (Unreleased)
- DSpace 6.x (EOL)
- DSpace 5.x (EOL)
- More Versions...
...
The database schema used by DSpace is created by SQL statements stored in a directory specific to each supported RDBMS platform:
Also in _\[dspace-source\]/dspace/etc/\[database\]_ are various SQL files called _database_schema_1x_1y_. These contain the necessary SQL commands to update a live DSpace database from version 1._x_ to 1._y_. Note that this might not be the only part of an upgrade process: see Updating a DSpace Installation for details. Wiki Markup
The DSpace database code uses an SQL function getnextid to assign primary keys to newly created rows. This SQL function must be safe to use if several JVMs are accessing the database at once; for example, the Web UI might be creating new rows in the database at the same time as the batch item importer. The PostgreSQL-specific implementation of the method uses SEQUENCES for each table in order to create new IDs. If an alternative database backend were to be used, the implementation of getnextid could be updated to operate with that specific DBMS.
The etc directory in the source distribution contains two further SQL files. clean-database.sql contains the SQL necessary to completely clean out the database, so use with caution! The Ant target clean_database can be used to execute this. update-sequences.sql contains SQL to reset the primary key generation sequences to appropriate values. You'd need to do this if, for example, you're restoring a backup database dump which creates rows with specific primary keys already defined. In such a case, the sequences would allocate primary keys that were already used.unmigrated-wiki-markup
Versions of the *_.sql{_}* files for Oracle are stored in _\[dspace-source\]/dspace/etc/oracle_. These need to be copied over their PostgreSQL counterparts in _\[dspace-source\]/dspace/etc_ prior to installation.
When using PostgreSQL, it's a good idea to perform regular 'vacuuming' of the database to optimize performance. This is performed by the vacuumdb command which can be executed via a 'cron' job, for example by putting this in the system crontab:
...
Code Block |
---|
DELETE FROM dctyperegistry; DELETE FROM bitstreamformatregistry; DELETE FROM epersongroup; |
Wiki Markup |
Code Block |
---|
psql -U dspace -f [dspace-source]/dspace/etc/update-sequences.sql |
...
Code Block |
---|
assetstore.dir = [dspace]/assetstore |
(Remember that _\[dspace\]_ is a placeholder for the actual name of your DSpace install directory). Wiki Markup
The above example specifies a single asset store.
...