How to find (and restore) a single document from your Alfresco backup ?

If you want to find/restore a copy of a single document from a previous “alf_data/contentstore” backup, you can use the following steps:

First I assume you know the filename of the document you are looking for…
In the example below, it is: ‘Portal services offering.ppt’

Also, I assume you will be able to restore the backup copy of the database on a testing database server (with the proposed approach, no need to restore the contentstore on a real server filesystem, I also assume that your documents backup utility give you the opportunity to search a file into the backup archive without needing to restore the full contentstore on a file system…).

Run the following query on your database copy (restored from the backup):
select * from ALF_NODE_PROPERTIES where STRING_VALUE=’Portal services offering.ppt’ and QNAME='{http://www.alfresco.org/model/content/1.0}name’;

If you get one result (or more), you can then use the NODE_ID value(s) to identify the specific version your are looking for:
(if you get several values, that propably means there are several versions or copies of the same document).

Example:
select * from ALF_NODE_PROPERTIES where NODE_ID=14066558;

In the search result, you can check the version number of the document (if any) by looking at the value related to this attribute (see QNAME column):
{http://www.alfresco.org/model/content/1.0}versionLabel

For each NODE_ID of your list, the QNAME='{http://www.alfresco.org/model/content/1.0}content’ property should contain a value like:
contentUrl=store://2009/10/28/16/9/e594bfcc-c3d3-11de-a2cf-79b22a9754d5.bin(…)

Example:
select * from ALF_NODE_PROPERTIES where NODE_ID=14066558;
contentUrl=store://2009/10/28/16/9/e594bfcc-c3d3-11de-a2cf-79b22a9754d5.bin|mimetype=application/vnd.powerpoint|size=640512|encoding=UTF-8|locale=fr_FR_

select * from ALF_NODE_PROPERTIES where NODE_ID=93913845;
contentUrl=store://2009/9/29/15/0/1198d8f9-acf8-11de-8873-67b05ed3557b.bin|mimetype=application/vnd.powerpoint|size=620032|encoding=UTF-8|locale=fr_FR_

The path ‘//2009/10/28/16/9/’ corresponds to this directory in the alf_data contentstore (document storage):
‘alf_data/contentstore/2009/10/28/16/9/2009/10/28/16/9/’

So you should be able to use this info to find the corresponding directory in your contentstore backup archive.

And the file “e594bfcc-c3d3-11de-a2cf-79b22a9754d5.bin” correspond to a copy of your documents ‘Portal services offering.ppt’ which has been renamed automatically by Alfresco durung the save operation.

Hope this will help,

related post: 3 ways to find and restore a (single) “lost” document stored in Alfresco

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: