web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Dynamics 365 by Manish / Tier-2 + sandbox missing at...

Tier-2 + sandbox missing attachments after restore database

ManishMoothedath Profile Picture ManishMoothedath 7

Scenario : A Tier-2 sandbox used for end user training has to be refreshed from a baseline version every 2 or 3 days (backup of the same sandbox environment) to start over with fresh database with config, setups and master data. After each restore the attachments against some of the master / config data stored in Azure storage is missing or isn't accessible.

Solution:

Record attachment information is stored in the DocuRef and DocuView tables. The DocuRef table is the record that represents the attachment. The DocuRef record points to the record being attached to and to a DocuView record. The DocuView record points to the file that is the attachment. Attachments saved in azure storage (blob) has a major benefit, any database operations, like restoring from backup, will only affect the database information about the attachment, not the attachment file itself stored in blob. 

So, all you need to do is correct some of the access information of that files in DocuValue table, where this information is stored. 

run this below script against AxDB - 
you can find blob url easily - Open any form in d365fo and import a new file. after successful import of file navigate to DocuValue table and find the filename just imported. Note the blob url under the column AccessInformation.

e.g 'https://d365fo594ad1b.blob.core.windows.net/documents/'  do not include the fileid after 'documents/'

update docuvalue set storageproviderid=1, accessinformation=concat(',docuvalue.fileid)

Comments

*This post is locked for comments