locked
Deleting CRM Attachments from CRM 4.0 Database RRS feed

  • Question

  • Hi all,

    May I know by setting the Body content of activitymimeattachment table will reduce the CRM database size.

    Basically I want to take backup of all the attachments (save them under activitymimeattachmentid_activityid folder) and leave the Filename as it is so in future if we want to know if the Email has any attachments we know by name and trace it back but remove the body content from the attachment.

    Regards,

    Dani.

    Thursday, January 10, 2013 5:55 AM

Answers

All replies

  • I recommend updating the content with a simple text string like "File archived" or similar. Just remember to convert the string to base64 as this is how CRM stores file contents. You could then update the filename with a .txt extension and updated mimetype. When the use opens it they will see your message.

    MS CRM Bing'd - http://bingsoft.wordpress.com
    Dynamics XRM Tools CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM 2011 OData Query Designer
    CRM 2011 Metadata Browser
    CRM Forum Guidance

    Thursday, January 10, 2013 1:54 PM
    Moderator
  • Thank you RhettClinton. That helped me and good tip to replace the content and changing the File Name to .txt extension. 

    But by removing the content will the database size reduce? The reason I ask is I didn't see any change in the size. I removed atleast 5GB of attachments but the database size remains same.

    Do i need to do anything to reduce the DB size? 

    Like rebuild indexes/reorganize/update statistics  on activitymimeattachment table?

    Regards,

    Dani.

    Thursday, January 10, 2013 10:43 PM
  • You can use SQL commands such as ShrinkFile or ShrinkDatabase in SQL Server or use SQL Server Management Studio to do it with the menu  options. http://technet.microsoft.com/en-us/library/ms189035.aspx

    Sometimes the db may not shrink and you need to do a backup before you shrink.


    MS CRM Bing'd - http://bingsoft.wordpress.com
    Dynamics XRM Tools CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM 2011 OData Query Designer
    CRM 2011 Metadata Browser
    CRM Forum Guidance

    Thursday, January 10, 2013 11:11 PM
    Moderator