Hi, It sounds like your database sequences have become outdated... and DSpace 7 is trying to install resourcepolicies starting with ID=1... this is incorrect behavior as it should start the ID at the next available value.
The way to normally fix this is to run the "update-sequences" command BEFORE you export your database contents out of DSpace 6.3. Or, you could try downloading the v6.3 version of the "update-sequences.sql" script and running it manually on your database: https://github.com/DSpace/DSpace/blob/dspace-6.3/dspace/etc/postgres/update-sequences.sql (In that file you minimally need to run the line that pertains to "resourcepolicy_seq" as that's the table that is causing you issues.) I've added a note about this to our Migration guide... see bullet 2 under "Step 2: Prepare your data to copy..." https://wiki.lyrasis.org/display/DSDOC7x/Migrating+DSpace+to+a+new+server Hopefully that helps, as I suspect that's the issue you're hitting. Tim On Friday, June 23, 2023 at 3:42:10 PM UTC-5 michel.m...@gmail.com wrote: > *[Help]* I read everything they sent, tested it and nothing. > Apparently everything is fine, it starts the migration, but it gives this > error when it arrives at version "6.0.2015.09.01 DS-2701", it tries to > insert existing information. I tried to skip this specific version and it > didn't work. > > Is it a migration bug? > > Version(*6.0.2015.09.01 DS-2701*) where the error actually occurs: > > Caused by: java.sql.SQLException: Flyway executeSql() error occurred at >> org.dspace.storage.rdbms.DatabaseUtils.executeSql(DatabaseUtils.java:1253) >> at org.dspace.storage.rdbms.xmlworkflow. >> *V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration* >> .migrate(V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration.java:75) > > > During migration in version it generates duplicate key error in *table > "resourcepolicy"*: > > -- Update the sequences > > SELECT setval('cwf_workflowitem_seq', max(workflowitem_id)) FROM >> cwf_workflowitem; > > SELECT setval('cwf_collectionrole_seq', max(collectionrole_id)) FROM >> cwf_collectionrole; > > SELECT setval('cwf_workflowitemrole_seq', max(workflowitemrole_id)) FROM >> cwf_workflowitemrole; > > SELECT setval('cwf_pooltask_seq', max(pooltask_id)) FROM cwf_pooltask; > > SELECT setval('cwf_claimtask_seq', max(claimtask_id)) FROM cwf_claimtask; > > SELECT setval('cwf_in_progress_user_seq', max(in_progress_user_id)) FROM >> cwf_in_progress_user; > > ]; ERROR: *duplicate key value violates unique constraint >> "resourcepolicy_pkey"* > > Detalhe: *Key (policy_id)=(1) already exists.;* nested exception is >> org.postgresql.util.PSQLException: ERROR: duplicate key value violates >> unique constraint "resourcepolicy_pkey" > > Detalhe: Key (policy_id)=(1) already exists. > > Image 1 > [image: image.png] > Image 2 > [image: image.png] > > > Em qua., 21 de jun. de 2023 às 11:05, Michel Montenegro < > michel.m...@gmail.com> escreveu: > >> Mohammad and support >> >> Executing the command [1]: >> >>> C:\dspace\bin>*dspace database info* >> >> Result: >> >>> | Category | Version | Description >>> | Type | Installed On >>> | State | >> >> | Versioned | 7.0.2018.06.07 | DS-3851-permission >>> | SQL | 2023-06-21 10:25:10 | Success | >> >> *| Versioned | 5.0.2014.11.04 | Enable XMLWorkflow Migration* >>> *| JDBC | | Ignored |* >> >> >>> *| Versioned | 6.0.2015.09.01 | DS 2701 Enable XMLWorkflow Migration | >>> JDBC | | Ignored |*| Versioned >>> | 7.0.2019.05.02 | DS-4239-workflow-xml-migration | >>> SQL | | Pending | >> >> >> Note: The command "dspace *database skip* [Version]" didn't work, I >> tried using it on versions marked as "ignored" (5.0.2014.11.04 and >> 6.0.2015.09.01). >> >> Executing the command [2]: >> >>> C:\dspace\bin>dspace database* migrate ignored* >> >> The commands run normally, and stop right here: >> >>> -- Update the sequences >>> *ERROR: duplicate key value violates unique constraint >>> "resourcepolicy_pkey"* >> >> >> Executing the command [3]: >> >>> C:\dspace\bin>dspace database* update-sequences* >> >> Result: >> >>> *Caught exception: org.postgresql.util.PSQLException: ERROR: relation >>> "systemwidealert" does not exist* >> >> >> >> >> Em ter., 20 de jun. de 2023 às 23:36, Mohammad S. AlMutairi < >> alo...@gmail.com> escreveu: >> >>> All you need after importing the database properly into the new server >>> is to run [dspace]/bin//dspace database migrate ignored on the new >>> server and just copy the assetstore folder from the old server to the new >>> one and finally do a discovery index by running [dspace]/bin/dspace >>> index-discovery -b . Check Tim's comments/explanations in the following >>> thread >>> https://groups.google.com/g/dspace-tech/c/_7XI9xmwpI8/m/CH__FIU_AwAJ >>> and this one too >>> https://groups.google.com/g/dspace-tech/c/_7XI9xmwpI8/m/DvYbGKx3AgAJ >>> ... Ignore any other comments in that thread and only apply what matches >>> the issue you have so you don't get it confused. >>> >>> Mo. >>> >>> On Tuesday, June 20, 2023 at 11:08:56 PM UTC+3 Michel Montenegro wrote: >>> >>>> Mohammad S. AlMutairi I ran the instructions and the dump and restore >>>> went flawlessly with no errors. >>>> >>>> When running "dspace database info" the result seems correct, however >>>> it had two IGNORED instead of success. (See attached image >>>> "Dump_Restore_Sucess6x_and_2Ignore.png") >>>> >>>> I attached the two logs referring to the commands "dspace database >>>> update-sequences" e "dspace database migrate ignored". >>>> >>>> Em sáb., 17 de jun. de 2023 às 04:04, Mohammad S. AlMutairi < >>>> alo...@gmail.com> escreveu: >>>> >>>>> Correction: # You need to change the bin folder path in step 1 & 5 to >>>>> match yours. >>>>> >>>>> On Saturday, June 17, 2023 at 9:55:33 AM UTC+3 Mohammad S. AlMutairi >>>>> wrote: >>>>> >>>>>> On Friday, June 16, 2023 at 11:44:22 AM UTC+3 Michel Montenegro wrote: >>>>>> >>>>>> The problem seems to be at the base of 6.3 (At this moment I don't >>>>>> know how the team's DBAs solved it when generating the dump), but we >>>>>> managed to start the migration, however during the migration it stopped >>>>>> and >>>>>> generated the following error (The 6.3 database this one being migrated >>>>>> had >>>>>> nothing added, it's the 6.3 core ): >>>>>> >>>>>> Hi All, >>>>>> It seems all the issues you are facing in your migration is caused of >>>>>> how the the old database is exported and imported in the new server. >>>>>> Just >>>>>> make sure before following the steps you see below the pgcrypto >>>>>> extension >>>>>> was created on the database in the old server and not add into the >>>>>> extensions schema. Once you sucessed on importing the database follow >>>>>> the >>>>>> other steps in the link Tim provided >>>>>> https://wiki.lyrasis.org/display/DSDOC7x/Migrating+DSpace+to+a+new+server >>>>>> >>>>>> # You need to change the bin folder path in step 2 & 6 to match yours. >>>>>> 1) cd "C:\Program Files\PostgreSQL\9.13\bin" >>>>>> 2) .\pg_dump -U postgres -W -h localhost -Fc -v -C -E UTF8 -d dspace >>>>>> -f C:\dspace-63.sql >>>>>> 3) Move dspace-63.sql file to the new dspace server >>>>>> >>>>>> On the new dspace server execute: >>>>>> 1) psql --username=postgres dspace >>>>>> 2) DROP EXTENSION pgcrypto; >>>>>> 3) DROP SCHEMA extensions; >>>>>> 4) \q >>>>>> 5) cd "C:\Program Files\PostgreSQL\13\bin" >>>>>> 6) .\pg_restore -U postgres -W -h localhost -v -e -c --if-exists -d >>>>>> dspace C:\dspace-63.sql >>>>>> 7) psql --username=postgres dspace >>>>>> 8) \dn >>>>>> 9) \dx >>>>>> 10) \q >>>>>> >>>>>> Hope it helps. >>>>>> >>>>>> Mo. >>>>>> >>>>>> -- >>>>> 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...@googlegroups.com. >>>>> >>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/dspace-tech/f26b09c5-cdfa-4970-8ea8-1076f21323abn%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/dspace-tech/f26b09c5-cdfa-4970-8ea8-1076f21323abn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> >>>> >>>> -- >>>> Atenciosamente, >>>> *Michel Pinheiro Montenegro* >>>> - *Bacharel* em Sistema de Informação >>>> - [Lato Sensu] *Especialista* em Engenharia de Sistemas >>>> - [Stricto Sensu] *Mestre* em Ciência da Computação >>>> - [Stricto Sensu] *Doutorando* em Ciência da Computação >>>> >>>> E-mail/Gtalk: michel.m...@gmail.com >>>> >>> -- >>> 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...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/dspace-tech/46253e26-287c-4f80-8a4c-a81f3b41ac1fn%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/dspace-tech/46253e26-287c-4f80-8a4c-a81f3b41ac1fn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Atenciosamente, >> *Michel Pinheiro Montenegro* >> - *Bacharel* em Sistema de Informação >> - [Lato Sensu] *Especialista* em Engenharia de Sistemas >> - [Stricto Sensu] *Mestre* em Ciência da Computação >> - [Stricto Sensu] *Doutorando* em Ciência da Computação >> >> E-mail/Gtalk: michel.m...@gmail.com >> > > > -- > Atenciosamente, > *Michel Pinheiro Montenegro* > - *Bacharel* em Sistema de Informação > - [Lato Sensu] *Especialista* em Engenharia de Sistemas > - [Stricto Sensu] *Mestre* em Ciência da Computação > - [Stricto Sensu] *Doutorando* em Ciência da Computação > > E-mail/Gtalk: michel.m...@gmail.com > -- 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/20dd416d-52ed-4fb5-8ffa-d842fe518562n%40googlegroups.com.