Created
September 17, 2020 21:42
-
-
Save danielrolfe/4c594513a0ce4c41af93c9980fa07faf to your computer and use it in GitHub Desktop.
Simple SQL script to delete the recycle bin rows from the Sitecore Archive tables. Use it at your own risk!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @CleanupList table(ArchivalId uniqueidentifier) | |
declare @ArchivalId uniqueidentifier | |
insert into @CleanupList(ArchivalId) | |
select ArchivalId | |
from dbo.Archive | |
where ArchiveName = 'recyclebin' | |
while(1 = 1) | |
begin | |
set @ArchivalId = NULL | |
select top (1) @ArchivalId = ArchivalId | |
from @CleanupList | |
if @ArchivalId IS NULL | |
break | |
delete from dbo.ArchivedFields where ArchivalId = @ArchivalId | |
delete from dbo.ArchivedItems where ArchivalId = @ArchivalId | |
delete from dbo.ArchivedVersions where ArchivalId = @ArchivalId | |
delete from dbo.Archive where ArchivalId = @ArchivalId | |
delete top(1) from @CleanupList | |
end |
Database and Operations --> Database Cleanup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@sansani4 The cleanup database option in administration tools is what removes orphaned blobs from the blob table. :)