How to restore deleted Assets (Insight) object types or objects in Jira Data Center

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

Purpose

You might have mistakenly deleted an Assets Object Type when you just wanted to delete one Assets Object — it happens.

However, it's not possible to restore a deleted Assets object or an object type or redo the deletion. We have a Suggestion ticket JSDSERVER-8650 - Introduce dedicated backup / restore functionality for Insight open for future implementation.

This KB is to outline a few possible ways to retrieve the deleted data.

Solution

1. Restore from backup (XML or DB)

Restore Jira data from XML or database backup. This ensures that the deleted Assets data is completely recovered.

This completely overwrites Jira application data and hence, any update made after the backup is made will be lost.

2. From another instance

If you have another Jira instance where the deleted data can be extracted, you could import it to the current instance via CSV import or object schema import.

You should also note that any other schema or object type related configurations like import configurations, automations, roles etc will not be imported via Object Schema import.

Imports create objects from scratch, new object keys will be created and object history will be overwritten. This also means that if a deleted object was connected to a Jira issue, the "restored" object will not be automatically connected as the link between objects and Jira issues will not be imported.

3. Restoring only Assets DB tables

Restore only Assets-related database tables from your database backup that contains the Assets data to be recovered, using database native function to copy or migrate the data. All Assets-related database tables have the prefix of AO_8542F1.

Please note Atlassian does not provide support to restore the data this way, as different database types with different versions may have different ways to copy data from one database to another. We recommend engaging your DBA to determine the best way to copy between databases. 

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.

Assets tables have Foreign Keys to one another (all within the AO_8542F1_* "domain") so the order of deletes and restores is important. Here's an example of the order the 57 AO_8542F1 tables can have their records deleted and restored as of JSM 5.12:

Click here to expand an example of DELETE order

Delete the tables or their data on this exact order:

AO_8542F1_IFJ_ATM_RULE_AC_LOG
AO_8542F1_IFJ_ATM_WL
AO_8542F1_IFJ_EXPORT_REQUESTS
AO_8542F1_IFJ_FEATURE
AO_8542F1_IFJ_IMPORT_MISS
AO_8542F1_IFJ_IMPORT_SRC
AO_8542F1_IFJ_IM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E
AO_8542F1_IFJ_OBJ
AO_8542F1_IFJ_OBJ_TYPE
AO_8542F1_IFJ_ICON_THEME
AO_8542F1_IFJ_ICON
AO_8542F1_IFJ_REF_TYPE
AO_8542F1_IFJ_OBJ_SCHEMA
Click here to expand an example of RESTORE order

The restore must be done in the inverse order of the delete:

AO_8542F1_IFJ_OBJ_SCHEMA
AO_8542F1_IFJ_REF_TYPE
AO_8542F1_IFJ_ICON
AO_8542F1_IFJ_ICON_THEME
AO_8542F1_IFJ_OBJ_TYPE
AO_8542F1_IFJ_OBJ
AO_8542F1_IFJ_ROLE
AO_8542F1_IFJ_ROLE_ACTOR
AO_8542F1_IFJ_OBJ_TYPE_ATTR
AO_8542F1_IFJ_OBJ_ATTR
AO_8542F1_IFJ_OBJ_ATTR_VAL
AO_8542F1_IFJ_RCF_CONNECT
AO_8542F1_IFJ_RCF_TO_REFTYPE
AO_8542F1_IFJ_CF_CONNECT
AO_8542F1_IFJ_COMMENT
AO_8542F1_IFJ_OBJ_ATTACH
AO_8542F1_IFJ_OBJ_HIST
AO_8542F1_IFJ_OBJ_JIRAISSUE
AO_8542F1_IFJ_OBJ_WATCH
AO_8542F1_IFJ_FILE
AO_8542F1_IFJ_DCF_CONNECT
AO_8542F1_IFJ_LABEL_TMP
AO_8542F1_IFJ_IMAGE
AO_8542F1_IFJ_STATUS_TYPE
AO_8542F1_IFJ_SD_PROP
AO_8542F1_IFJ_ON_EVENT
AO_8542F1_IFJ_ON_EVENT_USER
AO_8542F1_IFJ_ON_FILTER
AO_8542F1_IFJ_ON_FILTER_SHARE
AO_8542F1_IFJ_ON_FILTER_FAV
AO_8542F1_IFJ_ON_FILTER_ATTR
AO_8542F1_IFJ_WIDGET
AO_8542F1_IFJ_WIDGET_LBL
AO_8542F1_IFJ_WIDGET_TO_LBL
AO_8542F1_IFJ_WIDGET_SHARE
AO_8542F1_IFJ_WIDGET_FAV
AO_8542F1_IFJ_ATM_RULE
AO_8542F1_IFJ_ATM_RULE_EV
AO_8542F1_IFJ_ATM_RULE_CO_AC
AO_8542F1_IFJ_ATM_RULE_CO
AO_8542F1_IFJ_ATM_RULE_AC
AO_8542F1_IFJ_USER_GOT_MSG
AO_8542F1_IFJ_USER
AO_8542F1_IFJ_RES_REF
AO_8542F1_IFJ_PRG_RES
AO_8542F1_IFJ_PRG_OT_RES
AO_8542F1_IFJ_PRG_IN_PRG
AO_8542F1_IFJ_ON_TYPE_CONFIG
AO_8542F1_IFJ_OBJ_KEY_MAP
AO_8542F1_IFJ_IMPORT_SRC_OTA
AO_8542F1_IFJ_IMPORT_SRC_OT
AO_8542F1_IFJ_IMPORT_SRC
AO_8542F1_IFJ_IMPORT_MISS
AO_8542F1_IFJ_FEATURE
AO_8542F1_IFJ_EXPORT_REQUESTS
AO_8542F1_IFJ_ATM_WL
AO_8542F1_IFJ_ATM_RULE_AC_LOG

4. Restoring Custom fields

If you've decided to restore only the schema or the Assets tables (options 2 or 3), then custom fields that had references to the deleted schema will not recover their references.

To solve this, please refer to the guide at How to restore a deleted custom field in Jira. Even though the custom fields themselves were not deleted, this page will help with the procedure to recover the values from before the deletion.


An alternative strategy...

An alternative strategy to recover the custom fields would be to get the values from the issue history and then update the issues using either a CSV import or calling the REST API in bulk to update the issues.

To fetch the previous values from the issue history, you could use a query such as this one, built for PostgreSQL:

WITH tbl AS (
  SELECT
    concat(p.pkey,'-',i.issuenum) as issuekey,
	ci.oldvalue,
	ci.newvalue,
    row_number() over(partition by cg.issueid order by cg.created desc) as rownum
	FROM changegroup cg
	JOIN changeitem ci on ci.groupid=cg.id
	JOIN jiraissue i on cg.issueid=i.id
	JOIN project p on p.id=i.project
	WHERE ci.field = '<CUSTOM_FIELD_NAME>' -- replace <CUSTOM_FIELD_NAME> by the actual field name
)
SELECT issuekey,
	replace(replace(oldvalue,'[',''),']','') as value
FROM tbl
WHERE rownum=1 AND (newvalue='' OR newvalue is null)

(info) This query assumes that the field had only values from the deleted schema, so it was set to empty.




DescriptionHow to restore deleted Assets (Insight) object types or objects
ProductInsight - Asset Management

Last modified on Oct 30, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.