How to migrate user contributions to new user name

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

Versions of JIRA prior to version 6 lacked the Rename User functionality available to admins today. In order to make a username change, a new user account needed to be created and data from the deprecated user account needed to be migrated to that new account using a hack on an XML backup of the system. This guide will walk any admins still running an older version of JIRA through this hack. Please note that Atlassian recommends that admins consider upgrading to the latest version of JIRA applications to take advantage of the Rename Users functionality rather than rely on this hack.


The content on this page relates to platforms that are not supported by JIRA applications. Consequently, Atlassian can not guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done at your own risk.


Steps to Migrate the User Contributions

The example given below is the method to migrate the contributions for username 'david.m' to 'david.martin' with the assumption user is created from an LDAP integration.

  1. First, create an XML backup from your JIRA instance. (Do not create the user david.martin just yet)
  2. Jira をシャットダウンします。
  3. Use the following command to find all the strings that contain the username david.m

    egrep -n david.m entities.xml
  4. Change all the affected strings from 'david.m' to 'david.martin'.  The example command below applies to linux and unix platforms:

    cat entities.xml | sed 's/david.m/david.martin/g' > entities-patched.xml

    Note: This does not apply  if the username is mixed case, so if you have a mixed case username situation, please perform the replacement twice. (Example: once for david.m, once for David.M)

  5. Verify all the entities changed correctly:

    grep david.m entities-patched.xml

    This should not return result if fully replaced.

  6. Optional, check which string is replaced by comparing:

    diff -y --suppress-common-lines entities.xml entities-patched.xml
  7. Finally replace the entities.xml with the newly created entities file:

    mv -f entities-patched.xml entities.xml
  8. Create the user david.martin on your LDAP server.
  9. Perform a restore to your test server to make sure that the contributions are successfully transferred. (DO NOT restore to the production server without testing it). Run a full synchronization on your user directories if the username is greyed out.


You might run into the following problem if you have the user created before migration:

Error importing data: java.lang.Exception: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UserHistoryItem][id,28185][username,david.martin][entityId,10000][lastViewed,1315819985752][type,Dashboard] (SQL Exception while executing the following:INSERT INTO public.userhistoryitem (ID, entitytype, entityid, USERNAME, lastviewed, data) VALUES (?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "uh_type_user_entity"))

This is due to multiple entries for the user david.martin being detected and therefore cannot be inserted into the table.

grep UserHistoryItem entities.xml | grep david.martin | grep 10000

Try to locate the duplicated entries with the command above. Note: the 10000 value is referring to the entityId found on the error message. It might be different on different instances.


最終更新日 2019 年 7 月 26 日

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

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