Please, always CC dspace-tech.
It seems what you're doing is running the data export over an existing
database (with data).
What you should do instead is take the export (created using pg_dump),
import it into an empty database (you can create a separate database
for that purpose), let's call it "dspace_new" and then run the upgrade
scripts in the correct order:
[dspace-src]/dspace/etc/postgres/database_schema_17-18.sql
[dspace-src]/dspace/etc/postgres/database_schema_18-3.sql
These will upgrade the database format from 1.7 to 3, keeping the existing data.
Then simply point your dspace to the new database name (in dspac.cfg)
and restart it:
db.url = jdbc:postgresql://localhost:5432/dspace_new
On Wed, Apr 24, 2013 at 4:47 PM, Abhishek Kulkarni
<
akul...@hawk.iit.edu> wrote:
> Hello Ivan,
>
> Can you please help me out with importing postgres database?
> I have installed dspace 3.1 (fresh install) on new server and already have
> dspace 1.7 running on another server.
> I copied entire assetstore from 1.7 to 3.1 dspace.
> After copying, I tried searching for items in new dspace, and no results
> were thrown.
> Then, it struck me about DB import too.
> How do I import dspace1.7.sql dump into new dspace 3.1?
> I tried \i command but it threw all duplication errors as below: -
>
>
> psql:/home/guru/DBDump/new_dump.sql:301051: ERROR: duplicate key value
> violates unique constraint "metadataschemaregistry_pkey"
> DETAIL: Key (metadata_schema_id)=(1) already exists.
> CONTEXT: COPY metadataschemaregistry, line 1: "1
>
http://dublincore.org/documents/dcmi-terms/ dc"
> psql:/home/guru/DBDump/new_dump.sql:354919: ERROR: duplicate key value
> violates unique constraint "metadatavalue_pkey"
> DETAIL: Key (metadata_value_id)=(128) already exists.
> CONTEXT: COPY metadatavalue, line 1: "128 23 3 Stewart,
> John L. \N 1 \N -1"
> psql:/home/guru/DBDump/new_dump.sql:466775: ERROR: insert or update on
> table "resourcepolicy" violates foreign key constraint
> "resourcepolicy_epersongroup_id_fkey"
> DETAIL: Key (epersongroup_id)=(67) is not present in table "epersongroup".
> psql:/home/guru/DBDump/new_dump.sql:466807: ERROR: insert or update on
> table "subscription" violates foreign key constraint
> "subscription_eperson_id_fkey"
> DETAIL: Key (eperson_id)=(38) is not present in table "eperson".
> psql:/home/guru/DBDump/new_dump.sql:466951: ERROR: insert or update on
> table "tasklistitem" violates foreign key constraint
> "tasklistitem_eperson_id_fkey"
> DETAIL: Key (eperson_id)=(340) is not present in table "eperson".
> psql:/home/guru/DBDump/new_dump.sql:467027: ERROR: insert or update on
> table "workflowitem" violates foreign key constraint
> "workflowitem_item_id_fkey"
> DETAIL: Key (item_id)=(3223) is not present in table "item".
> psql:/home/guru/DBDump/new_dump.sql:467197: ERROR: insert or update on
> table "workspaceitem" violates foreign key constraint
> "workspaceitem_item_id_fkey"
> DETAIL: Key (item_id)=(1708) is not present in table "item".
> psql:/home/guru/DBDump/new_dump.sql:467205: ERROR: multiple primary keys
> for table "bi_2_dis" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467213: ERROR: multiple primary keys
> for table "bi_2_dmap" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467221: ERROR: multiple primary keys
> for table "bi_4_dis" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467229: ERROR: multiple primary keys
> for table "bi_4_dmap" are not allowed
> ALTER TABLE
> ALTER TABLE
> psql:/home/guru/DBDump/new_dump.sql:467253: ERROR: multiple primary keys
> for table "bi_item" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467261: ERROR: multiple primary keys
> for table "bi_withdrawn" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467269: ERROR: multiple primary keys
> for table "bitstream" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467277: ERROR: multiple primary keys
> for table "bitstreamformatregistry" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467285: ERROR: relation
> "bitstreamformatregistry_short_description_key" already exists
> psql:/home/guru/DBDump/new_dump.sql:467293: ERROR: multiple primary keys
> for table "bundle2bitstream" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467301: ERROR: multiple primary keys
> for table "bundle" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467309: ERROR: multiple primary keys
> for table "checksum_history" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467317: ERROR: multiple primary keys
> for table "checksum_results" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467325: ERROR: multiple primary keys
> for table "collection2item" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467333: ERROR: multiple primary keys
> for table "collection_item_count" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467341: ERROR: multiple primary keys
> for table "collection" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467349: ERROR: multiple primary keys
> for table "communities2item" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467357: ERROR: multiple primary keys
> for table "community2collection" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467365: ERROR: multiple primary keys
> for table "community2community" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467373: ERROR: multiple primary keys
> for table "community_item_count" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467381: ERROR: multiple primary keys
> for table "community" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467389: ERROR: relation
> "eperson_email_key" already exists
> psql:/home/guru/DBDump/new_dump.sql:467397: ERROR: multiple primary keys
> for table "eperson" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467405: ERROR: multiple primary keys
> for table "epersongroup2eperson" are not allowed
> psql:/home/guru/DBDump/new_dump.sql:467413: ERROR: multiple primary keys
> for table "epersongroup2workspaceitem" are not allowed
>
>
>
> Please help.
>
> Thanks,
> Abhishek
>
>
>
> On Mon, Apr 22, 2013 at 11:48 AM, helix84 <
hel...@centrum.sk> wrote:
>>
>> My point was that you should do this:
>>
>> <dc-schema>iit</dc-schema>
>> <dc-element>embargo</dc-element>
>> <dc-qualifier>terms</dc-qualifier>
>>
>>