Import data from Dspace 6.x to Dspace 7.x by José M. Ravasi, 03/03/2023
Migrating data from Dsapace 6.x to Dspace 7.2.1 On the server where Dspace7 is installed and in my case with debian 11; using terminal. 1- Test that Dspace 7.x is working ok both the backend and the frontend. 2- Stop BackEnd (tomcat9) 3- and Front End 4- Deletion of the DB that had been broken by previous tests, as in the case that the administrator user had been created. $sudo su postgres If I do dropdb dspace it returns me that there are connections, so I must know what PID or connections there are and then stop those connections to be able to delete the db. To do this, I enter psql, find out, stop, go to postgres, do dropdb and then recreate the database. The steps are: $ psql -d dspace $ SELECT *FROM pg_stat_activity WHERE datname='dspace'; It returns a table with the existing connections to the db=dspace, I must write down the PID numbers. To stop active connections; Write down the PID numbers that appear when executing the previous command. $SELECT pg_terminate_backend(PID number) FROM pg_stat_activity WHERE datname='dspace'; repeat for each PID. $\q to go back to postgres and kill the database. postgres@devdspace:/home/dspace$ dropdb dspace Now the database must be created again with all its characteristics postgres@devdspace:/home/dspace$ createdb dspace -E UNICODE; Enter as user dspace with the command postgres@devdspace:/home/dspace$ psql -d dspace Make dspace user db owner dspace=# ALTER DATABASE dspace OWNER TO dspace; ALTER DATABASE Create the pgcrypto extension for the db dspace=# CREATE EXTENSION pgcrypto; CREATE EXTENSION give privileges dspace=# GRANT ALL PRIVILEGES ON DATABASE dspace TO dspace; GRANT Assign password to the db; That password is the one we use in the local.cfg to access the database (it must be the same as the one defined in the BackEnd in the local.cfg for there to be a connection to the database). dspace=# ALTER ROLE dspace WITH PASSWORD '123456'; ALTER ROLE With the \l command, show the databases and their owners. We exit to postgres with \q dspace=# \q and then we exit postgres with exit postgres@devdspace:/home/dspace$exit 5- Copy/dump the BD on the machine that has Dspace 6.x. In my case I did it in postgres 9.6 and the data file in format=custom with the following command: sudo pg_dump --format=custom -U dspace -W -h localhost dspace > mybase63 6- Restore data dump from dspace 6.x to Dspace 7. On the server running Dspace 7.x restore from within postgres13 with the command: pg_restore --username=postgres --host=localhost --port=5432 --dbname=dspace -v mibase63 When it asks for a password, it is that of the user postgres=******** 7- Copy the /assetstore folder from the dspace6.3 server to the new Dspace7 server 8- Run as Tim says ./dspace database migrate ignored 9- Restart Tomcat for the BackEnd and FrontEnd (pm2 start dspace-ui.json) 10- Then run ./dspace index-discovery -b 11- In the browser http://ipdemiservidor:4000/home And there were the logs of my dspace63 in DSpace 7!!!!!!!!!!! Importar datos desde Dspace 6.x a Dspace 7.x por José M. Ravasi 03/03/2023 Migrar los datos desde Dsapace 6.x a Dspace 7.2.1 En el servidor donde esta instalado Dspace7 y en mi caso con debian 11; usando el terminal. 1- Probar que Dspace 7.x este funcionando ok tanto el backend como el frontend. 2- Detener BackEnd (tomcat9) 3- y FrontEnd 4- Borrado de la BD que había quedado rota por pruebas anteriores, como ser el caso de que hubiera creado el usuario administrador. $sudo su postgres <postgres@devdspace> Si hago dropdb dspace me devuelve que hay conexiones, entonces debo saber que PID o conexiones hay y luego detener esas conexiones para poder borrar la bd. Para ello entro al psql, averiguo, detengo, salgo al postgres, hago el dropdb y luego vuelvo a crear la BD. Los pasos son: $ psql -d dspace $ SELECT *FROM pg_stat_activity WHERE datname=’dspace’; Devuelve una tabla con las conexiones existentes a la bd=dspace, debo anotar los núemros de PID. Para detener las conexiones activas; anotar los numeros PID que aparecen al ejecutar la orden anterior. $SELECT pg_terminate_backend(número PID) FROM pg_stat_activity WHERE datname='dspace'; repertir para cada PID. $\q para volver a posgres y matar la base de datos. postgres@devdspace:/home/dspace$ *dropdb dspace* Ahora se debe crear nuevamente la base de datos con todas sus caracteristicas postgres@devdspace:/home/dspace$ *createdb dspace -E UNICODE;* Entrar como usuario dspace con la orden postgres@devdspace:/home/dspace$ *psql -d dspace* Hacer propietario de la bd al usuario dspace dspace=# *ALTER DATABASE dspace OWNER TO dspace; * ALTER DATABASE Crear la extensión pgcrypto para la bd dspace=# *CREATE EXTENSION pgcrypto;* CREATE EXTENSION Dar privilegios dspace=# GRANT ALL PRIVILEGES ON DATABASE dspace TO dspace; GRANT Asignar password a la bd; esa password es la que usamos en el local.cfg para que acceda a la base de datos (debe ser la misma que la definidad en el BcakEnd en el local.cfg para que haya conexión con la base de datos). dspace=# ALTER ROLE dspace WITH PASSWORD '123456'; ALTER ROLE Con el comando \l muestra las bases datos y sus propietarios Salimos al postgres con \q dspace=# \q y luego salimos del postgres con exit postgres@devdspace:/home/dspace$ exit 5- Realizar copia/volcado de BD en la máquina que tiene el Dspace 6.x. En mi caso lo hice en postgres 9.6 y el archivo de datos en formato=custom con la orden que sigue: sudo pg_dump --format=custom -U dspace -W -h localhost dspace > mibase63 6- Restaurar volcado de datos de dspace 6.x en Dspace 7. En el servidor que tiene Dspace 7.x restaurar desde dentro del postgres13 con el comando: pg_restore --username=postgres –host=localhost --port=5432 --dbname=dspace -v mibase63 Cuando pide contraseña es la del usuario postgres=******* 7- Copiar la carpeta /assetstore desde el servidor dspace6.3 hacia el nuevo servidor Dspace7 8- Correr como dice Tim ./dspace database migrate ignored 9- Rearrancar el Tomcat para el BackEnd y el FrontEnd (pm2 start dspace-ui.json) 10- Luego ejecutar ./dspace index-discovery -b 11- En el navegador http://ipdemiservidor:4000/home Y allí estaban los registros de mi dspace63 en DSpace 7!!!!!!!!!!! -- Lic. José Miguel Ravasi -- All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx --- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/CAPN8yDq1xSuqQGEiHJuEhAgjzFKjs%2B%3DLTsbkHMxZ99%3DifJZVFQ%40mail.gmail.com.