Thursday, June 2, 2016

Restore old versions of Dspace to Dspace 6

Take a backup of Dspace database and folders

Assume that the old version of Dspace is running. Take a PostgreSQL database backup. Open a Terminal and apply following commands,

sudo su - postgres
pg_dump dspace > dspace.backup

The above command take a backup of Dspace database and store in /var/lib/postgresql/ .Copy the database.backup file to a safe place.

Copy assetstore and log folders

Here we are going to backup essential things. All uploaded files stored in assetstore folder.

sudo zip -r /dspace/assetstore
sudo zip -r /dspace/log

Restoration of backup to the latest version of Dspace

Install latest Dspace version. Copy the assetstore, log folders, and database backup to home folder of the system. Extract the assetstore and log folders. Follow the below steps to restore old Dspace backup.

Stop Tomcat server

sudo service tomcat stop

Remove asset store and log folders

sudo rm -rf /dspace/assetstore
sudo rm -rf /dspace/log/

Move your old assetstore and log folders to /dspace folder.

sudo mv assetstore /dspace
sudo mv log /dspace

Restoration of database

Restart PostgreSQL

sudo systemctl stop postgresql
sudo systemctl start postgresql

Drop the database and create a new one. Apply following commands one by one,

sudo -u postgres psql

Make sure that the dspace.backup file in home folder. Apply the following command one by one to restore the database backup.

psql -f dspace.backup dspace 

Install pgcrypto postgres extension

Execute the following commands one by one,

sudo su postgres
psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"

Apply following commands

sudo /dspace/bin/dspace database info
sudo /dspace/bin/dspace database migrate
sudo /dspace/bin/dspace index-discovery -b
sudo /dspace/bin/dspace filter-media
sudo /dspace/bin/dspace index-discovery
sudo /dspace/bin/dspace index-discovery -o

Restart Tomcat

sudo service tomcat start

Open DSpace in a browser

Information courtesy


  1. su -dspace no lo reconoce y el psql da lo siguiente:
    psql: could not connect to server: No existe el archivo o el directorio
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

    Lo instale siguiendo las otras instrucciones, ahora quiero migrar la base de datos vieja..

  2. Dear Vimal Ji,
    I have a dspace 4.2 repository. It is installed as per your dspace 4.2 guide line. Now i want to update to 5.x. Pl. instruct me. I tried with the above one but unable to succeed.