For umbraco 7+ (currently last release 7.7.7) i made this script to empty both media and document recycle bin:
DELETE FROM cmsPreviewXml WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM cmsContentVersion WHERE ContentId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM cmsDocument WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM cmsTagRelationship WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM cmsContentXML WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM cmsContent WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM cmsPropertyData WHERE contentNodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM umbracoDomains WHERE domainRootStructureID IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM umbracoUser2NodePermission WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM umbracorelation WHERE parentId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM umbracorelation WHERE childId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
DELETE FROM umbracoredirecturl WHERE contentKey IN (SELECT uniqueID FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
ALTER TABLE `umbraconode` DROP FOREIGN KEY `umbraconode_ibfk_1`;
DELETE FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20);
ALTER TABLE `umbraconode` ADD CONSTRAINT `umbraconode_ibfk_1` FOREIGN KEY (`parentID`) REFERENCES `umbraconode`(`id`);
I noticed some errors related to cmsContent what was about to be deleted but had a foreign key constrain to a media item, after emptying the media recycle bin from the backoffice this code worked great on Umbraco v7.12.3.
Edit:
Also for 7.8+ the umbracoUser2NodePermission-row can be changed to
DELETE FROM umbracoUserGroup2NodePermission WHERE nodeId IN (SELECT id FROM umbracoNode WHERE (path LIKE '%-21%' AND id!=-21) OR (path LIKE '%-20%' AND id!=-20));
Unable to empty recycle bin
Hi our! :)
Currently got a problem where i can't empty my recycle bin, it just gives me an "Timeout error" with "500 (Internal Server Error)"
The site did run Umbraco 7.5.6 so i tried to upgrade to Umbraco 7.5.14, but it didn't help.
It's both content and media recycle bin that i can't empty.
I'm trying to empty those since the database is using 2.2GB, and i have UnVersion installed :)
Hi Anders
Maybe it will help you, really nice SQL query for clearing Umbraco database, it can reduce size drastically:
https://gist.github.com/dampee/a8ead728165b16d49c00
Thanks,
Alex
Hi Alex,
Thanks for your time! :)
I will try run that script, currently i have tried this one,
https://gist.github.com/genckastrati/0e7f7ae6156647e00a56eb5ef403166d
But it didn't allowed me to empty the recycle bins :(
You are welcome, also can you check what is timeout for sql server operations?
Try to check it with MSSQL management studio.
Hope it will help,
Alex
For umbraco 7+ (currently last release 7.7.7) i made this script to empty both media and document recycle bin:
Backup your DB before trying it.
Thanks for sharing this!
I noticed some errors related to cmsContent what was about to be deleted but had a foreign key constrain to a media item, after emptying the media recycle bin from the backoffice this code worked great on Umbraco v7.12.3.
Edit: Also for 7.8+ the umbracoUser2NodePermission-row can be changed to
// m
Is this script working for the latest Umbraco version?
Can anyone help with a version to Umbraco 8?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.