How to restore deleted users in Jira
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.
You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.
We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!
Summary
The deletion of a user is an unadvised scenario — whenever possible you should aim to disable users instead of deleting them.
Exceptions may occur, though, like severe LDAP failures or misconfiguration leading to users being deleted during the next synchronization, wiping out group memberships and project roles data, too. Recreating the users (by restoring LDAP, for example) won't restore their previous local group memberships and project roles.
This article offers a less dramatic alternative than a full database restore. If the steps outlined here don't work for your specific situation, you may either consider a full database restore to retrieve users, local memberships and roles or reapply them manually through Jira's web interface once the users have recreated with the same usernames as before.
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Environment
The steps outlined on this article are applicable to all versions of Jira from 7.0 to 8.5, and Jira Service Management from 3.0 to 4.5.
Solution
Users and groups are referenced by 3 ways in Jira:
- Internal ID
- Name (upper and lower cases)
- Lowercase name
When users are deleted and recreated their usernames should be the same, but the internal IDs would've changed. We're interested here in restoring the tables that contain the IDs and others that were cascade-deleted from user deletion. Other tables that weren't affected and refer to group names or usernames can remain as they're are.
To restore the deleted users, you will need a database backup from when the users and groups were on a healthy status. The procedure is as follows:
- Stop Jira (if Datacenter, stop all nodes)
- Take a new backup of Jira database (for rollback purpose)
Restore these 7 tables from the previously known good backup (before the deletions):
app_user cwd_group cwd_group_attributes cwd_user cwd_user_attributes cwd_membership projectroleactor
- Start Jira
- Validate users' accesses
The projectroleactor
table references usernames but is cascade-deleted when a user is deleted and so needs to be restored as well.
Other tables that may reference usernames like notification
and schemepermissions
aren't cascade-deleted like projectroleactor
and don't need to be restored.