Duplicated entry - unique constraint violated in Jira Data Center

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

問題

ログに次のようなスタック トレースが含まれる場合があります。

Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:GlobalPermissionEntry][group_id,BED-Jira-Access][permission,USE][id,10015] (SQL Exception while executing the following:INSERT INTO globalpermissionentry (ID, PERMISSION, GROUP_ID) VALUES (?, ?, ?) (Duplicate entry '10015' for key 'PRIMARY'))
    at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:214)
    at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:179)
Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:GadgetUserPreference][id,60081][userprefvalue,assignees][userprefkey,ystattype][portletconfiguration,13951] (SQL Exception while executing the following:INSERT INTO gadgetuserpreference (ID, PORTLETCONFIGURATION, USERPREFKEY, USERPREFVALUE) VALUES (?, ?, ?, ?) (ORA-00001: unique constraint (JIRAPROD.PK_GADGETUSERPREFERENCE) violated
))
    at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:136)
    at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:101)
Caused by: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:PortletConfiguration][position,0][id,14485][portalpage,12305][color,color1][gadgetXml,rest/gadgets/1.0/g/com.atlassian.jira.gadgets:admin-gadget/gadgets/admin-gadget.xml][columnNumber,0] (SQL Exception while executing the following:INSERT INTO portletconfiguration (ID, PORTALPAGE, PORTLET_ID, COLUMN_NUMBER, positionseq, GADGET_XML, COLOR) VALUES (?, ?, ?, ?, ?, ?, ?) (ORA-00001: unique constraint (JIRAPROD.PK_PORTLETCONFIGURATION) violated
2013-08-05 10:46:05,050 http-bio-8080-exec-2838 ERROR [500ErrorPage.jsp] Exception caught in 500 page org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ApplicationUser][id,10002][userKey,oarteaga][lowerUserName,oarteaga] (SQL Exception while executing the following:INSERT INTO app_user (ID, user_key, lower_user_name) VALUES (?, ?, ?) (Duplicate entry '10002' for key 1))
com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ApplicationUser][id,10002][userKey,oarteaga][lowerUserName,oarteaga] (SQL Exception while executing the following:INSERT INTO app_user (ID, user_key, lower_user_name) VALUES (?, ?, ?) (Duplicate entry '10002' for key 1))
Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Membership][id,82263][membershipType,GROUP_USER][lowerParentName,nicr][parentId,80014][childId,42310][childName,lhooipen][lowerChildName,lhooipen][directoryId,10100][parentName,NICR] (SQL Exception while executing the following:INSERT INTO cwd_membership (ID, parent_id, child_id, membership_type, group_type, parent_name, lower_parent_name, child_name, lower_child_name, directory_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ORA-00001: unique constraint (JIRAUSER.PK_CWD_MEMBERSHIP) violated


診断

Diagnosis 1: for non-AO table

エラー メッセージでは、問題を返しているエンティティとそれに対応するテーブルを次のように確認できます。

org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Membership]

...
SQL Exception while executing the following:INSERT INTO cwd_membership

この例では、問題のエンティティは Membership で、対応するテーブルが cwd_membership であることがわかります。これにより、データベースで次のクエリを実行できます。

SELECT * FROM sequence_value_item WHERE seq_name = 'Membership';
SELECT max(id) FROM cwd_membership;


2 つめのクエリで返される値が 1 つめのクエリで返されるものよりも大きい場合、この問題の修正のためにソリューションの手順をご確認ください。これに該当しない場合は代替ソリューションをご確認ください。

利用されているテーブルの名前はエンティティの名前にほぼ一致します。ただし場合によっては名前が完全に一致しないことがあるため、上の例のように類似した名前を探す必要があることがあります。ご利用のデータベースのテーブル名では大文字と小文字が区別される点にご注意ください。sequence_value_item の代わりに SEQUENCE_VALUE_ITEM の利用が必要になることがあります。

SQL クエリで数値ソートの利用が必要になる可能性があります。例:

MySQL クエリ

SELECT max(CAST(id AS SIGNED)) FROM cwd_membership;

PostgreSQL クエリ
SELECT max(id::integer) FROM cwd_membership;


Diagnosis 2 - for AO tables

Refer to another kb article - https://confluence.atlassian.com/jirakb/getting-ora-00001-unique-constraint-error-while-performing-some-actions-in-jira-data-center-1318390669.html

原因

  • この問題の原因はまだはっきりしていませんが、更新試行が正常に完了せず、id 数の不一致につながった可能性が考えられます。
  • Also, this can occur after the migration from Jira Cloud to Jira Server/Datacenter.

ソリューション

データベースの変更を行う場合は 必ず事前にバックアップを取得してください。可能な場合はテスト サーバーで変更を試すことをおすすめします。

  1. Jira アプリケーションをシャットダウンします。
  2. データベースで次のクエリを実行します。

    UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM <TableName>) WHERE seq_name = '<EntityName>';

    Oracle データベースをご利用の場合は変更のコミットを忘れないようにしてください。

     '<EntityName>' と <TableName> を、エラー メッセージで表示された値で置き換えるようにします。

  3. Jira アプリケーションを再起動します。

たとえば、上の例の問題を修正するために利用される更新ステートメントは次のようになります。

UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM cwd_membership) WHERE seq_name = 'Membership'; 

代替ソリューション

シーケンス値が対象のテーブルの最大 ID よりも大きい (および失敗する ID 番号がすでに存在する) 場合は Jira の再起動をお試しください。

場合によって、Jira がデータベースを参照するのではなく次の ID 番号を内部で生成することがあります。このメモリ内の値がデータベース内の情報に対応していないとデータベース挿入に失敗します。

Restarting JIRA should allow for JIRA to re-read what's in the database and have the correct IDs to generate.


Mapping of sequence name and sequence_value_item 

The following is a mapping of sequence_value_item entries and a SQL script to update maximum ID.   The SQL script is useful in fixing possible multiple incorrect sequence ID values after a migration. The script has been tested in versions 8.20.11, 9.4.2, and 9.7.0.  

(warning) We recommend  backup the database before applying the script, and always test in non-production first.  Some minor adjustments may needed due to each Jira version may use a different  set of values.  

Mapping Table
seq_nameテーブル
操作jiraaction
ApplicationUserapp_user
アバターアバター
ChangeGroupchangegroup
ChangeItemchangeitem
コンポーネントcomponent
ClusterLockStatusclusterlockstatus
ClusterMessageclustermessage
ClusteredJobclusteredjob
ColumnLayoutcolumnlayout
ColumnLayoutItemcolumnlayoutitem
ConfigurationContextconfigurationcontext
カスタム フィールドcustomfield
CustomFieldOptioncustomfieldoption
CustomFieldValuecustomfieldvalue
DraftWorkflowjiradraftworkflows
DraftWorkflowSchemedraftworkflowscheme
DraftWorkflowSchemeEntitydraftworkflowschemeentity
EntityPropertyentity_property
EntityPropertyIndexDocumententity_property_index_document
EventTypejiraeventtype
FavouriteAssociationsfavouriteassociations
機能機能
FieldConfigSchemefieldconfigscheme
FieldConfigSchemeIssueTypefieldconfigschemeissuetype
FieldConfigurationfieldconfiguration
FieldLayoutfieldlayout
FieldLayoutItemfieldlayoutitem
FieldLayoutSchemefieldlayoutscheme
FieldLayoutSchemeAssociationfieldlayoutschemeassociation
FieldLayoutSchemeEntityfieldlayoutschemeentity
FieldScreenフィールドスクリーン
FieldScreenLayoutItemfieldscreenlayoutitem
FieldScreenSchemefieldscreenscheme
FieldScreenSchemeItemfieldscreenschemeitem
FieldScreenTabfieldscreentab
FileAttachmentfileattachment
FilterSubscriptionfiltersubscription
GadgetUserPreferencegadgetuserpreference
GenericConfigurationgenericconfiguration
GlobalPermissionEntryglobalpermissionentry
グループcwd_group
課題jiraissue
IssueFieldOptionissue_field_option
IssueFieldOptionScopeissue_field_option_scope
IssueLinkissuelink
IssueLinkTypeissuelinktype
IssueSecuritySchemeissuesecurityscheme
課題タイプissuetype
課題タイプ画面スキームissuetypescreenscheme
IssueTypeScreenSchemeEntityissuetypescreenschemeentity
IssueVersionissue_version
ラベルラベル
LicenseRoleDefaultlicenserolesdefault
LicenseRoleGrouplicenserolesgroup
ListenerConfiglistenerconfig
ManagedConfigurationItemmanagedconfigurationitem
メンバーシップcwd_membership
MovedIssueKeymoved_issue_key
NodeIndexCounternodeindexcounter
通知通知
NotificationSchemenotificationscheme
OAuthConsumeroauthconsumer
OSCurrentStepos_currentstep
OSPropertyEntrypropertyentry
OSWorkflowEntryos_wfentry
OptionConfigurationoptionconfiguration
PermissionSchemepermissionscheme
PermissionSchemeAttributepermissionschemeattribute
PluginVersionpluginversion
PortalPageportalpage
PortletConfigurationportletconfiguration
Priority優先度
ProductLicenseproductlicense
プロジェクトプロジェクト
ProjectCategoryprojectcategory
ProjectKeyproject_key
ProjectRoleprojectrole
ProjectRoleActorprojectroleactor
ReindexComponentreindex_component
ReindexRequestreindex_request
RememberMeTokenremembermetoken
ReplicatedIndexOperationreplicatedindexoperation
ソリューションresolution
RunDetailsrundetails
SchemePermissionsschemepermissions
SearchRequestsearchrequest
ServiceConfigserviceconfig
SharePermissionssharepermissions
ステータスissuestatus
UpgradeHistoryupgradehistory
UpgradeTaskHistoryupgradetaskhistory
UpgradeTaskHistoryAuditLogupgradetaskhistoryauditlog
UpgradeVersionHistoryupgradeversionhistory
ユーザーcwd_user
UserAttributecwd_user_attributes
UserHistoryItemuserhistoryitem
バージョンprojectversion
ワークフローjiraworkflows
WorkflowSchemeworkflowscheme
WorkflowSchemeEntityworkflowschemeentity
作業履歴作業ログ
WorklogVersionworklog_version
update-sequence.sql
content
 --  Action                      |  jiraaction
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM jiraaction) WHERE seq_name = 'Action' and 0 < (select count(*) from jiraaction);

 --  ApplicationUser             |  app_user
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM app_user) WHERE seq_name = 'ApplicationUser' and 0 < (select count(*) from app_user);

 -- Avatar                      |  avatar
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM avatar) WHERE seq_name = 'Avatar' and 0 < (select count(*) from avatar);

-- ChangeGroup                 |  changegroup
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM changegroup) WHERE seq_name = 'ChangeGroup' and 0 < (select count(*) from changegroup);

-- ChangeItem                  |  changeitem
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM changeitem) WHERE seq_name = 'ChangeItem' and 0 < (select count(*) from changeitem);

-- Component                   |  component
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM component) WHERE seq_name = 'Component' and 0 < (select count(*) from component);

-- ClusterLockStatus           |  clusterlockstatus
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM clusterlockstatus) WHERE seq_name = 'ClusterLockStatus' and 0 < (select count(*) from clusterlockstatus);

-- ClusterMessage              |  clustermessage
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM clustermessage) WHERE seq_name = 'ClusterMessage' and 0 < (select count(*) from clustermessage);

-- ClusteredJob                |  clusteredjob
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM clusteredjob) WHERE seq_name = 'ClusteredJob' and 0 < (select count(*) from clusteredjob);

-- ColumnLayout                |  columnlayout
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM columnlayout) WHERE seq_name = 'ColumnLayout' and 0 < (select count(*) from columnlayout);

-- ColumnLayoutItem            |  columnlayoutitem
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM columnlayoutitem) WHERE seq_name = 'ColumnLayoutItem' and 0 < (select count(*) from columnlayoutitem);

-- ConfigurationContext        |  configurationcontext
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM configurationcontext) WHERE seq_name = 'ConfigurationContext' and 0 < (select count(*) from configurationcontext);

-- CustomField                 |  customfield
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM customfield) WHERE seq_name = 'CustomField' and 0 < (select count(*) from customfield);

-- CustomFieldOption           |  customfieldoption
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM customfieldoption) WHERE seq_name = 'CustomFieldOption' and 0 < (select count(*) from customfieldoption);

-- CustomFieldValue            |  customfieldvalue
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM customfieldvalue) WHERE seq_name = 'CustomFieldValue' and 0 < (select count(*) from customfieldvalue);

-- DraftWorkflow               |  jiradraftworkflows
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM jiradraftworkflows) WHERE seq_name = 'DraftWorkflow' and 0 < (select count(*) from jiradraftworkflows);

-- DraftWorkflowScheme         |  draftworkflowscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM draftworkflowscheme) WHERE seq_name = 'DraftWorkflowScheme' and 0 < (select count(*) from draftworkflowscheme);

-- DraftWorkflowSchemeEntity   |  draftworkflowschemeentity
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM draftworkflowschemeentity) WHERE seq_name = 'DraftWorkflowSchemeEntity' and 0 < (select count(*) from draftworkflowschemeentity);

-- EntityProperty              |  entity_property
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM entity_property) WHERE seq_name = 'EntityProperty' and 0 < (select count(*) from entity_property);

-- EntityPropertyIndexDocument |  entity_property_index_document
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM entity_property_index_document) WHERE seq_name = 'EntityPropertyIndexDocument' and 0 < (select count(*) from entity_property_index_document);

-- EventType                   |  jiraeventtype
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM jiraeventtype) WHERE seq_name = 'EventType' and 0 < (select count(*) from jiraeventtype);

-- FavouriteAssociations       |  favouriteassociations
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM favouriteassociations) WHERE seq_name = 'FavouriteAssociations' and 0 < (select count(*) from favouriteassociations);

-- Feature                     |  feature
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM feature) WHERE seq_name = 'Feature' and 0 < (select count(*) from feature);

-- FieldConfigScheme           |  fieldconfigscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldconfigscheme) WHERE seq_name = 'FieldConfigScheme' and 0 < (select count(*) from fieldconfigscheme);

-- FieldConfigSchemeIssueType  |  fieldconfigschemeissuetype
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldconfigschemeissuetype) WHERE seq_name = 'FieldConfigSchemeIssueType' and 0 < (select count(*) from fieldconfigschemeissuetype);

-- FieldConfiguration          |  fieldconfiguration
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldconfiguration) WHERE seq_name = 'FieldConfiguration' and 0 < (select count(*) from fieldconfiguration);

-- FieldLayout                 |  fieldlayout
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldlayout) WHERE seq_name = 'FieldLayout' and 0 < (select count(*) from fieldlayout);

-- FieldLayoutItem             |  fieldlayoutitem
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldlayoutitem) WHERE seq_name = 'FieldLayoutItem' and 0 < (select count(*) from fieldlayoutitem);

-- FieldLayoutScheme           |  fieldlayoutscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldlayoutscheme) WHERE seq_name = 'FieldLayoutScheme' and 0 < (select count(*) from fieldlayoutscheme);

-- FieldLayoutSchemeAssociation|  fieldlayoutschemeassociation
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldlayoutschemeassociation) WHERE seq_name = 'FieldLayoutSchemeAssociation' and 0 < (select count(*) from fieldlayoutschemeassociation);

-- FieldLayoutSchemeEntity     |  fieldlayoutschemeentity
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldlayoutschemeentity) WHERE seq_name = 'FieldLayoutSchemeEntity' and 0 < (select count(*) from fieldlayoutschemeentity);

-- FieldScreen                 |  fieldscreen
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldscreen) WHERE seq_name = 'FieldScreen' and 0 < (select count(*) from fieldscreen);

-- FieldScreenLayoutItem       |  fieldscreenlayoutitem
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldscreenlayoutitem) WHERE seq_name = 'FieldScreenLayoutItem' and 0 < (select count(*) from fieldscreenlayoutitem);

-- FieldScreenScheme           |  fieldscreenscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldscreenscheme) WHERE seq_name = 'FieldScreenScheme' and 0 < (select count(*) from fieldscreenscheme);

-- FieldScreenSchemeItem       |  fieldscreenschemeitem
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldscreenschemeitem) WHERE seq_name = 'FieldScreenSchemeItem' and 0 < (select count(*) from fieldscreenschemeitem);

-- FieldScreenTab              |  fieldscreentab
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fieldscreentab) WHERE seq_name = 'FieldScreenTab' and 0 < (select count(*) from fieldscreentab);

-- FileAttachment              |  fileattachment
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM fileattachment) WHERE seq_name = 'FileAttachment' and 0 < (select count(*) from fileattachment);

-- FilterSubscription          |  filtersubscription
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM filtersubscription) WHERE seq_name = 'FilterSubscription' and 0 < (select count(*) from filtersubscription);

-- GadgetUserPreference        |  gadgetuserpreference
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM gadgetuserpreference) WHERE seq_name = 'GadgetUserPreference' and 0 < (select count(*) from gadgetuserpreference);

-- GenericConfiguration        |  genericconfiguration
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM genericconfiguration) WHERE seq_name = 'GenericConfiguration' and 0 < (select count(*) from genericconfiguration);

-- GlobalPermissionEntry       |  globalpermissionentry
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM globalpermissionentry) WHERE seq_name = 'GlobalPermissionEntry' and 0 < (select count(*) from globalpermissionentry);

-- Group                       |  cwd_group
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM cwd_group) WHERE seq_name = 'Group' and 0 < (select count(*) from cwd_group);

-- Issue                       |  jiraissue
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM jiraissue) WHERE seq_name = 'Issue' and 0 < (select count(*) from jiraissue);

-- IssueFieldOption            |  issue_field_option
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issue_field_option) WHERE seq_name = 'IssueFieldOption' and 0 < (select count(*) from issue_field_option);

-- IssueFieldOptionScope       |  issue_field_option_scope
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issue_field_option_scope) WHERE seq_name = 'IssueFieldOptionScope' and 0 < (select count(*) from issue_field_option_scope);

-- IssueLink                   |  issuelink
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issuelink) WHERE seq_name = 'IssueLink' and 0 < (select count(*) from issuelink);

-- IssueLinkType               |  issuelinktype
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issuelinktype) WHERE seq_name = 'IssueLinkType' and 0 < (select count(*) from issuelinktype);

-- IssueSecurityScheme         |  issuesecurityscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issuesecurityscheme) WHERE seq_name = 'IssueSecurityScheme' and 0 < (select count(*) from issuesecurityscheme);

-- IssueType                   |  issuetype (id is TEXT not numeric) - write your own UPDATE - write your own UPDATE
--UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issuetype) WHERE seq_name = 'IssueType' and 0 < (select count(*) from issuetype);

-- IssueTypeScreenScheme       |  issuetypescreenscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issuetypescreenscheme) WHERE seq_name = 'IssueTypeScreenScheme' and 0 < (select count(*) from issuetypescreenscheme);

-- IssueTypeScreenSchemeEntity |  issuetypescreenschemeentity
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issuetypescreenschemeentity) WHERE seq_name = 'IssueTypeScreenSchemeEntity' and 0 < (select count(*) from issuetypescreenschemeentity);

-- IssueVersion                |  issue_version
UPDATE sequence_value_item SET seq_id = (SELECT max(issue_id)+100 FROM issue_version) WHERE seq_name = 'IssueVersion' and 0 < (select count(*) from issue_version);

-- Label                       |  label
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM label) WHERE seq_name = 'Label' and 0 < (select count(*) from label);

-- LicenseRoleDefault          |  licenserolesdefault
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM licenserolesdefault) WHERE seq_name = 'LicenseRoleDefault' and 0 < (select count(*) from licenserolesdefault);

-- LicenseRoleGroup            |  licenserolesgroup
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM licenserolesgroup) WHERE seq_name = 'LicenseRoleGroup' and 0 < (select count(*) from licenserolesgroup);

-- ListenerConfig              |  listenerconfig
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM listenerconfig) WHERE seq_name = 'ListenerConfig' and 0 < (select count(*) from listenerconfig);

-- ManagedConfigurationItem    |  managedconfigurationitem
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM managedconfigurationitem) WHERE seq_name = 'ManagedConfigurationItem' and 0 < (select count(*) from managedconfigurationitem);

-- Membership                  |  cwd_membership
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM cwd_membership) WHERE seq_name = 'Membership' and 0 < (select count(*) from cwd_membership);

-- MovedIssueKey               |  moved_issue_key
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM moved_issue_key) WHERE seq_name = 'MovedIssueKey' and 0 < (select count(*) from moved_issue_key);

-- NodeIndexCounter            |  nodeindexcounter
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM nodeindexcounter) WHERE seq_name = 'NodeIndexCounter' and 0 < (select count(*) from nodeindexcounter);

-- Notification                |  notification
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM notification) WHERE seq_name = 'Notification' and 0 < (select count(*) from notification);

-- NotificationScheme          |  notificationscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM notificationscheme) WHERE seq_name = 'NotificationScheme' and 0 < (select count(*) from notificationscheme);

-- OAuthConsumer               |  oauthconsumer
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM oauthconsumer) WHERE seq_name = 'OAuthConsumer' and 0 < (select count(*) from oauthconsumer);

-- OSCurrentStep               |  os_currentstep
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM os_currentstep) WHERE seq_name = 'OSCurrentStep' and 0 < (select count(*) from os_currentstep);

-- OSPropertyEntry             |  propertyentry
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM propertyentry) WHERE seq_name = 'OSPropertyEntry' and 0 < (select count(*) from propertyentry);

-- OSWorkflowEntry             |  os_wfentry
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM os_wfentry) WHERE seq_name = 'OSWorkflowEntry' and 0 < (select count(*) from os_wfentry);

-- OptionConfiguration         |  optionconfiguration
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM optionconfiguration) WHERE seq_name = 'OptionConfiguration' and 0 < (select count(*) from optionconfiguration);

-- PermissionScheme            |  permissionscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM permissionscheme) WHERE seq_name = 'PermissionScheme' and 0 < (select count(*) from permissionscheme);

-- PermissionSchemeAttribute   |  permissionschemeattribute
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM permissionschemeattribute) WHERE seq_name = 'PermissionSchemeAttribute' and 0 < (select count(*) from permissionschemeattribute);

-- PluginVersion               |  propertyentry
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM propertyentry) WHERE seq_name = 'PluginVersion' and 0 < (select count(*) from pluginversion);

-- PortalPage                  |  portalpage
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM portalpage) WHERE seq_name = 'PortalPage' and 0 < (select count(*) from portalpage);

-- PortletConfiguration        |  portletconfiguration
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM portletconfiguration) WHERE seq_name = 'PortletConfiguration' and 0 < (select count(*) from portletconfiguration);

-- Priority                    |  priority (id is of character type) - write your own UPDATE
-- UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM priority) WHERE seq_name = 'Priority' and 0 < (select count(*) from priority);

-- ProductLicense              |  productlicense
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM productlicense) WHERE seq_name = 'ProductLicense' and 0 < (select count(*) from productlicense);

-- Project                     |  project
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM project) WHERE seq_name = 'Project' and 0 < (select count(*) from project);

-- ProjectCategory             |  projectcategory
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM projectcategory) WHERE seq_name = 'ProjectCategory' and 0 < (select count(*) from projectcategory);

-- ProjectKey                  |  project_key
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM project_key) WHERE seq_name = 'ProjectKey' and 0 < (select count(*) from project_key);

-- ProjectRole                 |  projectrole
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM projectrole) WHERE seq_name = 'ProjectRole' and 0 < (select count(*) from projectrole);

-- ProjectRoleActor            |  projectroleactor
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM projectroleactor) WHERE seq_name = 'ProjectRoleActor' and 0 < (select count(*) from projectroleactor);

-- ReindexComponent            |  reindex_component
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM reindex_component) WHERE seq_name = 'ReindexComponent' and 0 < (select count(*) from reindex_component);

-- ReindexRequest              |  reindex_request
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM reindex_request) WHERE seq_name = 'ReindexRequest' and 0 < (select count(*) from reindex_request);

-- RememberMeToken             |  remembermetoken
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM remembermetoken) WHERE seq_name = 'RememberMeToken' and 0 < (select count(*) from remembermetoken);

-- ReplicatedIndexOperation    |  replicatedindexoperation
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM replicatedindexoperation) WHERE seq_name = 'ReplicatedIndexOperation' and 0 < (select count(*) from replicatedindexoperation);

-- Resolution                  |  resolution (id is TEXT type) - write your own UPDATE
-- UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM resolution) WHERE seq_name = 'Resolution' and 0 < (select count(*) from resolution);

-- RunDetails                  |  rundetails
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM rundetails) WHERE seq_name = 'RunDetails' and 0 < (select count(*) from rundetails);

-- SchemePermissions           |  schemepermissions
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM schemepermissions) WHERE seq_name = 'SchemePermissions' and 0 < (select count(*) from schemepermissions);

-- SearchRequest               |  searchrequest
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM searchrequest) WHERE seq_name = 'SearchRequest' and 0 < (select count(*) from searchrequest);

-- ServiceConfig               |  serviceconfig
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM serviceconfig) WHERE seq_name = 'ServiceConfig' and 0 < (select count(*) from serviceconfig);

-- SharePermissions            |  sharepermissions
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM sharepermissions) WHERE seq_name = 'SharePermissions' and 0 < (select count(*) from sharepermissions);

-- Status                      |  issuestatus (id is TEXT type) - write your own UPDATE
-- UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM issuestatus) WHERE seq_name = 'Status' and 0 < (select count(*) from issuestatus);

-- UpgradeHistory              |  upgradehistory
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM upgradehistory) WHERE seq_name = 'UpgradeHistory' and 0 < (select count(*) from upgradehistory);

-- UpgradeTaskHistory          |  upgradetaskhistory
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM upgradetaskhistory) WHERE seq_name = 'UpgradeTaskHistory' and 0 < (select count(*) from upgradetaskhistory);

-- UpgradeTaskHistoryAuditLog  |  upgradetaskhistoryauditlog
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM upgradetaskhistoryauditlog) WHERE seq_name = 'UpgradeTaskHistoryAuditLog' and 0 < (select count(*) from upgradetaskhistoryauditlog);

-- UpgradeVersionHistory       |  upgradeversionhistory
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM upgradeversionhistory) WHERE seq_name = 'UpgradeVersionHistory' and 0 < (select count(*) from upgradeversionhistory);

-- User                        |  cwd_user
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM cwd_user) WHERE seq_name = 'User' and 0 < (select count(*) from cwd_user);

-- UserAttribute               |  cwd_user_attributes
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM cwd_user_attributes) WHERE seq_name = 'UserAttribute' and 0 < (select count(*) from cwd_user_attributes);

-- UserHistoryItem             |  userhistoryitem
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM userhistoryitem) WHERE seq_name = 'UserHistoryItem' and 0 < (select count(*) from userhistoryitem);

-- Version                     |  projectversion
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM projectversion) WHERE seq_name = 'Version' and 0 < (select count(*) from projectversion);

-- Workflow                    |  jiraworkflows
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM jiraworkflows) WHERE seq_name = 'Workflow' and 0 < (select count(*) from jiraworkflows);

-- WorkflowScheme              |  workflowscheme
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM workflowscheme) WHERE seq_name = 'WorkflowScheme' and 0 < (select count(*) from workflowscheme);

-- WorkflowSchemeEntity        |  workflowschemeentity
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM workflowschemeentity) WHERE seq_name = 'WorkflowSchemeEntity' and 0 < (select count(*) from workflowschemeentity);

-- Worklog                     |  worklog
UPDATE sequence_value_item SET seq_id = (SELECT max(id)+100 FROM worklog) WHERE seq_name = 'Worklog' and 0 < (select count(*) from worklog);

-- WorklogVersion              |  worklog_version
UPDATE sequence_value_item SET seq_id = (SELECT max(worklog_id)+100 FROM worklog_version) WHERE seq_name = 'WorklogVersion' and 0 < (select count(*) from worklog_version);
説明 ログに "Duplicated entry - unique constraint violated" のエラーが返される状況の場合、問題の解決にこの記事をご利用いただけます。
製品Jira
プラットフォームServer
最終更新日 2024 年 7 月 31 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.