0

I have added some images in sitecore media library. Those images are getting added in both dbo.Blobs and dbo.Items tables. I wanted to delete the image data from both the tables.But I don't know how to delete the entries in both the tables at the same time. These are the field in blobs table

enter image description here

I want to know, by using which field these tables are related to each other.

  • 5
    This is just how Sitecore works... a media item is an item and the media itself is added to the blob table, because it needs to be stored somewhere. You should NOT be trying to delete this using SQL. Delete it from the Content Tree or use the Sitecore API. I repeat, you should NOT be trying to delete this using SQL. – jammykam Jul 31 at 14:34
  • The problem is, even after deleting the media in content tree i can find the media in blobs table. So If i delete the media in content tree then that item has to be get deleted in the blobs table.Tell me how to achieve that. – kohila vani Aug 1 at 7:07
1

If you have orphaned blob items in your database, you should use Clean up databases tool from Sitecore Control Panel:

enter image description here

It:

  • Removes all invalid language items, i.e., items for which the language does not exist
  • Removes field data for non-existing items, including orphan fields
  • Removes orphaned items, i.e., items that do not have a parent item
  • Removes unused Blob fields of media items
  • Rebuilds the descendants tree
  • And finally, clears all Sitecore caches

Source: Improving Sitecore performance – by reducing volume of content

  • 1
    In Sitecore version 8 Clean up database is not working fine. In that case how to clean the blob table data? – kohila vani Aug 14 at 11:28
0

The Clean Up Databases command doesn't always work when there are a lot of items that need cleaning up. Try this SQL query for cleaning up the Blobs table to remove orphaned rows:

DECLARE @UsableBlobs table(
    ID uniqueidentifier
    );

INSERT INTO 
    @UsableBlobs    
select convert(uniqueidentifier,[Value]) as EmpID from [Fields]
where [Value] != '' 
and (FieldId='{40E50ED9-BA07-4702-992E-A912738D32DC}' or FieldId='{DBBE7D99-1388-4357-BB34-AD71EDF18ED3}') 
delete top (10000) from [Blobs] 
where [BlobId] not in (select * from @UsableBlobs)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.