Hello,
Seeking to reduce db size in preparation for migration from on-prem to online environment.
Currently dbo.Attachment and dbo.ActivityPointerBase are largest tables with 33GB and 24GB respectively.
I've used bulk deletion to deleted all emails with attachments over 1MB. But not change to Attachment table size. Why is this?
Any guidance for reduces other top 10 table sizes?
Thank you!
*This post is locked for comments
In order to reduce the db size, in particular concerning attachments, you can consider to store the attachments in sharepoint.
1. Develop a webservice that can write,delete and retrieve data in sharepoint.
2. Develop a plugin that triggers on creation, delete and retrieves of attachments
Create:
When the attachment is created in crm, a plugin calls the sharepoint webservice, stores the attachment in sharepoint and (IMPORTANT) update the attachment.body to NULL, automaticly the attachment.filesize is updated to 0.
Delete:
When a attachment is deleted in crm, delete the file in sharepoint by using the SP webservice delete function.
Retrieve:
When the emailform is loaded, in background a retrieve of the attachments is done in the crm db, for every retrieve the plugin does a retrieve in sharepoint and receives the filesize. In the plugin context you update this filesize from sharepoint, otherwise the attachment has a filesize of 0 in crm.
When you click on the attachment, you also do a retrieve in sharepoint to return the body, and update in the plugin the body in the context. This way, when you click in crm on a attachment, that is stored in SP, you get this attachment in SP, and can open it in crm. Nobody will see that the attachment in the background is stored en received in sharepoint.
This way you can reduce gb's of data in the crm database.
This way, when someone or the emailrouter creates a email with for example 16 attachments, all 16 attachments will be stored in sharepoint , and in the crm attachment table the body will be NULL , and filesize 0 .
In order to clear up the existing historicly data in attachments, write a service or console application and read from the attachment table and upload the data to sharepoint by using the sharepoint webservice.
There are several commercial packages that do these actions, but it's also written by yourself in 2 days.
This way i cleared up millions of attachments in a customers database.
That is strange. Usually, the table size reduces, but the database size remains same.
Could it be possible that most of your cases have multiple attachments that collectively have size greater than 5 MB, but are individually lesser?
if you have the counts of records before and after deletion, you will be able to validate better.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,151 Super User 2024 Season 2
Martin Dráb 229,993 Most Valuable Professional
nmaenpaa 101,156