How to Find An Archived Message's Corresponding File on Disk

  • 7020621
  • 11-Dec-2014
  • 07-Aug-2017


Retain 3.x, 4.x
MySQL (although same concepts can be applied to any SQL server)*


When a user opens a certain message in the Retain mailbox, the message contents are blank.  Is there a way to see if the corresponding archive file exists on disk (or if it is zero bytes)?


This knowledgebase (KB) article is provided for informational purposes only and as a courtesy service to you, our customer. GWAVA Technical Support does not have any database administration (DBA) expertise, nor does it provide DBA services or support. GWAVA is not responsible for the results of implementing any of the concepts contained in this KB article. Implementation of any of the concepts suggested in this KB article shall be done entirely at your own and sole risk, and GWAVA does not provide any kind of warranties whatsoever resulting from your decision of implementing any of the KB article’s concepts. It is up to you to do any research and to ensure yourself that any implementation and setup of any of the KB article’s concepts in your database system is correctly and properly executed. It is imperative that you have backups of your database system and storage directory before making any implementation. If you don’t have any DBA expertise, you should consult with a DBA expert before any implementation of the KB article’s concepts.  Under no circumstances, shall GWAVA, or any of its employees, be liable, in contract, tort, delict or otherwise, whether negligence is provable or not, for any direct, indirect, incidental, special, punitive, consequential or other damages, loss, cost or liability whatsoever that would result from or are related to the implementation of any of the concepts suggested in the KB article.

To the extent permitted by applicable law, GWAVA shall not be liable to you for any special, consequential, direct, indirect or similar damages, including any loss of data, arising out from migrating any type of messages, attachments, database, metadata in your Retain system to another server and/or location.


This can be done by running a SQL query in your Retain database.

1.  With the message open in the Retain mailbox, click on the Properties tab and make a note of the "Parent Node" number.  This number corresponds with the message ID for that message in the Retain database.


2. Login in to MySQL command line:  mysql -u [db username] -p [ENTER]

3. Tell MySQL to use the Retain database.

  • If the database name were "retain", at the MySQL command line type:  use retain [ENTER]

4.  Run the query:  SELECT hash FROM t_document INNER JOIN t_message_attachments ON t_document.document_id = t_message_attachments.document_id WHERE message_id = [parent node #];

Replace "[parent node #]" with the Parent Node number you obtained in step #1.


5.  It will produce at least one result if not more, depending on the number of attachments to that message.  Each one will show you the file (a.k.a., "document") hash, which will correspond with the file on disk.

6.  Now you can go to the "archive" directory on disk and see if that file exists.

The first 6 characters of the filename are the directory path where the file is stored.  Here is a document's file on disk from this example:

*Note: These instructions can be used almost exaclty the same for MSSQL except you'd need to open the SQL management studio instead.  The SELECT queries work the same way.

Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2420.