diff --git a/dspace/etc/oracle/database_schema_13-14.sql b/dspace/etc/oracle/database_schema_13-14.sql index b4ea96bffd..c1433e376d 100644 --- a/dspace/etc/oracle/database_schema_13-14.sql +++ b/dspace/etc/oracle/database_schema_13-14.sql @@ -136,9 +136,9 @@ CREATE VIEW dcvalue AS WHERE MetadataValue.metadata_field_id = MetadataFieldRegistry.metadata_field_id AND MetadataFieldRegistry.metadata_schema_id = 1; -SELECT setval('metadatafieldregistry_seq', max(metadata_field_id)) FROM metadatafieldregistry; -SELECT setval('metadatavalue_seq', max(metadata_value_id)) FROM metadatavalue; -SELECT setval('metadataschemaregistry_seq', max(metadata_schema_id)) FROM metadataschemaregistry; +@updateseq.sql metadatafieldregistry_seq metadatafieldregistry metadata_field_id; +@updateseq.sql metadatavalue_seq metadatavalue metadata_value_id; +@updateseq.sql metadataschemaregistry_seq metadataschemaregistry metadata_schema_id; DROP TABLE dctyperegistry; diff --git a/dspace/etc/oracle/update-sequences.sql b/dspace/etc/oracle/update-sequences.sql index 4041828240..f2d41e200e 100644 --- a/dspace/etc/oracle/update-sequences.sql +++ b/dspace/etc/oracle/update-sequences.sql @@ -57,37 +57,37 @@ -- depends on being run from sqlplus with incseq.sql in the current path -- you can find incseq.sql at: http://akadia.com/services/scripts/incseq.sql -@incseq.sql bitstreamformatregistry_seq bitstreamformatregistry bitstream_format_id -@incseq.sql fileextension_seq fileextension file_extension_id -@incseq.sql bitstream_seq bitstream bitstream_id -@incseq.sql eperson_seq eperson eperson_id -@incseq.sql epersongroup_seq epersongroup eperson_group_id -@incseq.sql group2group_seq group2group id -@incseq.sql group2groupcache group2groupcache id -@incseq.sql item_seq item item_id -@incseq.sql bundle_seq bundle bundle_id -@incseq.sql item2bundle_seq item2bundle id -@incseq.sql bundle2bitstream_seq bundle2bitstream id -@incseq.sql dctyperegistry_seq dctyperegistry dc_type_id -@incseq.sql dcvalue_seq dcvalue dc_value_id -@incseq.sql community_seq community community_id -@incseq.sql community2community_seq community2community id -@incseq.sql collection_seq collection collection_id -@incseq.sql community2collection_seq community2collection id -@incseq.sql collection2item_seq collection2item id -@incseq.sql resourcepolicy_seq resourcepolicy policy_id -@incseq.sql epersongroup2eperson_seq epersongroup2eperson id -@incseq.sql handle_seq handle handle_id -@incseq.sql workspaceitem_seq workspaceitem workspace_item_id -@incseq.sql workflowitem_seq workflowitem workflow_id -@incseq.sql tasklistitem_seq tasklistitem tasklist_id -@incseq.sql registrationdata_seq registrationdata registrationdata_id -@incseq.sql subscription_seq subscription subscription_id -@incseq.sql history_seq history history_id -@incseq.sql historystate_seq historystate history_state_id -@incseq.sql communities2item_seq communities2item id -@incseq.sql itemsbyauthor_seq itemsbyauthor items_by_author_id -@incseq.sql itemsbytitle_seq itemsbytitle items_by_title_id -@incseq.sql itemsbydate_seq itemsbydate items_by_date_id -@incseq.sql itemsbydateaccessioned_seq itemsbydateaccessioned items_by_date_accessioned_id -@incseq.sql epersongroup2workspaceitem_seq epersongroup2workspaceitem id \ No newline at end of file +@updateseq.sql bitstreamformatregistry_seq bitstreamformatregistry bitstream_format_id +@updateseq.sql fileextension_seq fileextension file_extension_id +@updateseq.sql bitstream_seq bitstream bitstream_id +@updateseq.sql eperson_seq eperson eperson_id +@updateseq.sql epersongroup_seq epersongroup eperson_group_id +@updateseq.sql group2group_seq group2group id +@updateseq.sql group2groupcache group2groupcache id +@updateseq.sql item_seq item item_id +@updateseq.sql bundle_seq bundle bundle_id +@updateseq.sql item2bundle_seq item2bundle id +@updateseq.sql bundle2bitstream_seq bundle2bitstream id +@updateseq.sql dctyperegistry_seq dctyperegistry dc_type_id +@updateseq.sql dcvalue_seq dcvalue dc_value_id +@updateseq.sql community_seq community community_id +@updateseq.sql community2community_seq community2community id +@updateseq.sql collection_seq collection collection_id +@updateseq.sql community2collection_seq community2collection id +@updateseq.sql collection2item_seq collection2item id +@updateseq.sql resourcepolicy_seq resourcepolicy policy_id +@updateseq.sql epersongroup2eperson_seq epersongroup2eperson id +@updateseq.sql handle_seq handle handle_id +@updateseq.sql workspaceitem_seq workspaceitem workspace_item_id +@updateseq.sql workflowitem_seq workflowitem workflow_id +@updateseq.sql tasklistitem_seq tasklistitem tasklist_id +@updateseq.sql registrationdata_seq registrationdata registrationdata_id +@updateseq.sql subscription_seq subscription subscription_id +@updateseq.sql history_seq history history_id +@updateseq.sql historystate_seq historystate history_state_id +@updateseq.sql communities2item_seq communities2item id +@updateseq.sql itemsbyauthor_seq itemsbyauthor items_by_author_id +@updateseq.sql itemsbytitle_seq itemsbytitle items_by_title_id +@updateseq.sql itemsbydate_seq itemsbydate items_by_date_id +@updateseq.sql itemsbydateaccessioned_seq itemsbydateaccessioned items_by_date_accessioned_id +@updateseq.sql epersongroup2workspaceitem_seq epersongroup2workspaceitem id \ No newline at end of file diff --git a/dspace/etc/oracle/updateseq.sql b/dspace/etc/oracle/updateseq.sql index 6e9561bb85..ee6c083426 100755 --- a/dspace/etc/oracle/updateseq.sql +++ b/dspace/etc/oracle/updateseq.sql @@ -10,27 +10,21 @@ -- 3: attribute name -- -- Sample usage: --- @updateseq-oracle.sql my_sequence my_table my_attribute +-- @updateseq.sql my_sequence my_table my_attribute -- -------------------------------------------------------------------------------- -- SET SERVEROUTPUT ON SIZE 1000000; -- DECLARE - dummy NUMBER := 0; curr NUMBER := 0; BEGIN - -- - --SELECT &1..nextval INTO dummy FROM dual; - --dbms_output.put('start with next value=' || dummy); - -- - SELECT max(&3) INTO curr FROM &2; + SELECT max(&3) INTO curr FROM &2 ; - DROP SEQUENCE &1; - CREATE SEQUENCE &1 START WITH curr; + curr := curr + 1; - -- - dbms_output.put_line(', end=' || dummy); - -- + EXECUTE IMMEDIATE 'DROP SEQUENCE &1'; + + EXECUTE IMMEDIATE 'CREATE SEQUENCE &1 START WITH ' || curr; END; /