When I am deleting a space from my confluence it stays at 2% completion for long time not completing
Asked by younoos:

When I am deleting a space from my confluence it stays at 2% completion for long time not completing the action. Since I wanted to import the package afresh, need to delete this space.. which I am not able to do. Please kindly help to expedite this delete process or any alternative solution to do for this.


Answers:
author: younoos
body: Hi [@Sachin](/t5/user/viewprofilepage/user-id/3827093)

Both removing space permission and Purging the Trash is not working for me as it keep rolling.

I need to import a package which has got same space key, that is the reason why i am trying to delete. What is better option to import the package with same space key.

There are couple of file entities.xml and exportDescriptor.properties in which we can modify the space key and can try to import the zip file however the entities.xml file the huge one in this case with around 2.5GB of size and 9.3millions of lines.

Please advise me better option.

comments: author: Sachin
body: I don't think there is any other way then editing the entities.xml file [@younoos](/t5/user/viewprofilepage/user-id/3657834) :/ . See [How to copy or rename a space in Confluence](https://confluence.atlassian.com/confkb/how-to-copy-or-rename-a-space-in-confluence-169578.html)

1. Open the space backup file with a zip file editor and find the file `entities.xml`.
2. Edit `entities.xml` in a text editor.
3. Do 'Search \& Replaces' for each of the space key patterns as shown below. Note carefully that letter casing matters here: The placeholder variables **OLDKEY** /**NEWKEY** represent to keys in **UPPER** or **MIXED-CASE** and **oldkey** /**newkey** represent keys in **all-lowercase** .
4. Also edit the `exportDescriptor.properties` file in a text editor. Change the *spaceKey* value in the `exportDescriptor.properties` file to the new spaceKey
5. Zip all the files, and import

If you don't need any exiting data on your confluence instance, you can try doing a full site export impot <https://confluence.atlassian.com/doc/restoring-a-site-152034.html>


author: younoos
body: Hi [@Sachin](/t5/user/viewprofilepage/user-id/3827093)

Thank you for your help.

The same url i have been referring. Since the entities.xml is huge file of size 2.5GB and contains nearly 9.3 millions of line, need to carefully search and replace as my space key is "BP", not that unique. Anyways thank you so much...


author: Sachin
body: Hello [@younoos](/t5/user/viewprofilepage/user-id/3657834) , do you see any errors in your application logs?. Meanwhile, you can also take a look at some of the workarounds from below articles:  

[Unable to delete a Confluence space due to "deleted object would be re-saved by cascade" error](https://confluence.atlassian.com/confkb/unable-to-delete-a-confluence-space-due-to-deleted-object-would-be-re-saved-by-cascade-error-976172839.html)

[Unable to Delete Space](https://confluence.atlassian.com/confkb/unable-to-delete-space-186515527.html)

[Space Deletion Hangs While Flushing Index Queue](https://confluence.atlassian.com/confkb/space-deletion-hangs-while-flushing-index-queue-652312765.html)


author: younoos
body: Hi [@Sachin](/t5/user/viewprofilepage/user-id/3827093)

Thanks you very much, here are error logs

2020-07-22 11:03:19,260 ERROR \[Long running task: Space removal long running task\] \[persistence.dao.filesystem.HierarchicalMultiStreamAttachmentDataFileSystem\] deleteAllAttachmentVersions Could not find attachment folder to remove at \[/var/opt/data/atlassian/shared-confluence-home/attachments/ver003/241/206/131956741/224/49/131799474/133435135\] for title \[page: 2015-09-02 Pension Categorisation Inception (The Smurfs) v.17 (131799474)\].  
-- space: 131956741 \| url: /spaces/doremovespace.action \| traceId: f7663929931873d0 \|

comments: author: Sachin
body: I have found this [post](https://community.atlassian.com/t5/Confluence-questions/Error-occurred-while-Delete-the-imported-space-in-Confluence-6/qaq-p/1219647) , where someone had a same error as yours, and they tried below steps, which you can give it a try

- Remove all SpacePermissions and purge all in the trash(removed all pages from trash).

- Try deleting the space


Tags: confluence-server

server