Query to retrieve Linked Repositories which aren't being used in any plans
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.
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 — though you may try them out.
You may follow through and validate them on your own non-prod environment prior to production or fall back to supported alternatives if they don't work out.
This SQL query will retrieve linked repositories (global ones) that aren't used in any plans (no plans listed under the tab).
This was tested on Microsoft SQL Server 2019.
select VL.NAME, VL.VCS_LOCATION_ID, CONCAT('<BAMBOO_BASE_URL>/admin/editLinkedRepository.action?repositoryId=',VL.VCS_LOCATION_ID) AS EDIT_URL from VCS_LOCATION VL where VL.VCS_LOCATION_ID NOT IN ( select VL.PARENT_ID from VCS_LOCATION VL JOIN PLAN_VCS_LOCATION PVL on VL.VCS_LOCATION_ID = PVL.VCS_LOCATION_ID ) AND VL.IS_GLOBAL = 1 AND VL.MARKED_FOR_DELETION = 0 AND VL.PARENT_ID IS NULL
For your convenience, if you replace <BAMBOO_BASE_URL> with your Bamboo's URL, the third column of the result (EDIT_URL) will contain a direct URL to the web page where you can edit the Linked Repo. If you export it to Excel, you can use the following formula to convert the URL to an Hyperlink. E.g:
If you use a different DBMS, the above query will need to be translated into your DBMS's syntax.