Removing Orphaned SLAs from the database

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Summary

Always back up your data before making any database modifications. 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!

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:

1 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:

1 2 3 4 5 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:

1 DELETE FROM AO_54307E_TIMEMETRIC WHERE ID=<sla_id>;

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

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.