Hello Everyone,
I am creating this article to address a very common issue related to the migration of spaces using Confluence Cloud Migration Assistant aka CCMA: Failed to read XYZ attachments.
You might have come across an issue when migrating spaces from Server/DC to Cloud using CCMA, where some attachments are failing to read and the migration of space fails.
Very common reasons why attachments cannot be found in server/DC:
-
Either the file has been deleted manually OR,
-
There was an error in removing the record of the attachment from Confluence.
Here are some of the steps you should follow after a failed migration because of missing attachments:
Option 1:
- You can follow this article to resolve missing attachments before doing another migration.
- It may happen that there are no results of the script following the above step, in that case, move to option 2.
Option 2:
-- -- Select attachments with 'DELETED' in CONTENT_STATUS column
SELECT CONTENTID FROM CONTENT INNER JOIN SPACES ON CONTENT.SPACEID = SPACES.SPACEID WHERE SPACES.SPACEKEY = 'YOUR_SPACE_KEY' AND CONTENTTYPE = 'ATTACHMENT' AND CONTENT_STATUS = 'DELETED'
If there are any results to the above query, run the below query to delete those missing attachments:
DELETE FROM MIG_ATTACHMENT WHERE ATTACHMENTID IN (SELECT CONTENTID FROM CONTENT INNER JOIN SPACES ON CONTENT.SPACEID = SPACES.SPACEID WHERE SPACES.SPACEKEY = 'YOUR_SPACE_KEY' AND CONTENTTYPE = 'ATTACHMENT' AND CONTENT_STATUS = 'DELETED'
You will need to delete attachments from previously failed migration. CCMA adds an entry in the MIG_ATTACHMENT table but sets the mediaId to NULL Those entries need to be deleted. Use the query below.
DELETE FROM MIG_ATTACHMENT WHERE mediaId IS NULL and cloudId = 'XXXXX’
If still, you run into the same issues, raise a support ticket with the Migrations team from https://support.atlassian.com
Option 3:
- If none of the above options are helpful then, reach out to us raising a ticket on https://support.atlassian.com, we can help you with either deleting the bad entries or provide a dark feature to be enabled on the Confluence Server to skip those entries during the migration.