Removing Orphaned SLAs from the database

Still need help?

The Atlassian Community is here for you.

Ask the community


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

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.

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

On occasion deleting a project does not delete the SLA's associated to that project.  Due to database associations of SLAs with the deleted project, these SLAs cannot be removed from the UI, and instead must be deleted from the database directly.

Environment

4.20.2

Solution

First, you'll need to get the ID of the SLA from the AO_54307E_TIMEMETRIC table. In the below query you'll need to replace <sla-name> with the name of the SLA to be removed:

SELECT ID FROM AO_54307E_TIMEMETRIC WHERE NAME='<sla-name>';

Based on the return from the above query, the ID will be used in the subsequent queries for the TIME_METRIC_ID  value. 

Next We then need to delete entries from the following 3 AO tables. We'll want you to replace <sla_id>  in the below queries with the value returned from the select query:

DELETE FROM AO_54307E_METRICCONDITION WHERE TIME_METRIC_ID=<sla_id>;

DELETE FROM AO_54307E_THRESHOLD WHERE TIME_METRIC_ID=<sla_id>;

DELETE FROM AO_54307E_GOAL WHERE TIME_METRIC_ID=<sla_id>;

Now that the key constraints have been removed, you can delete the SLA from the AO_54307E_TIMEMETRIC table:

DELETE FROM AO_54307E_TIMEMETRIC WHERE ID=<sla_id>;

This should fully remove the SLA from your environment and from the UI within JSM.


Last modified on Jan 31, 2023

Was this helpful?

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