Friday, March 21, 2008

Retreive Deleted Documents

Whenever a document is deleted, only the document's metadata is deleted. The content itself (i.e. the object pointed to by the dmr_content object) remains in the content storage area until the IAPI script generated by the dmclean utility is run.Assuming that the dmclean utility has not been run, it is still possible to recover the object's content file.

Note: The document's attributes cannot be recovered without going back to a database backup. Below is an outline of a strategy which can be used to do this recovery.

Initially, you need to gather some data on the document that you want to recover such as:
In DQL: select * from dm_audittrail where event_name='dm_destroy'
a) What was the name of the client machine where the file was last checked in? This is the set_client attribute.
b) What was the date/time of the last checkin? This is the set_time attribute.
c) What format was the document? This is the full_format attribute.
d) What was the name of the object? This is the object_name attribute.
For E.g : recoverddoc
With this information, the following query can be issued
IDQL: select r_object_id from dmr_content where any parent_id is null and set_client = and full_format = and set_time > DATE('')

This will retrieve a set of r_object_id's that correspond to content objects that have been deleted and meet your criteria. Once you have found the appropriate r_object_id of the deleted document, you are ready to find the file.
Using IAPI, execute the following commands:
API> apply,c,,GET_PATH
API> next,c,q0
API> get,c,q0,result
This returns the file system path to the object.
For example: 'c:\Documentum\data\happydays\content_storage_01\00003039\80\00\00\e6.doc'

Using DQL:
create "dm_document" OBJECT SET "object_name"='recoverddoc',SET "authors"='chandu', SETFILE 'c:\Documentum\data\happydays\content_storage_01\00003039\80\00\00\e6.doc' with content_format='msw8'

Alternatively using API’sNow that you have the path of the content file, you can create a new object with this content by doing the following:
API> create,c,dm_document 0900006580005a65
API> set,c,,object_name
SET> Restored Document
OK
API> setfile,c,,'c:\Documentum\data\happydays\content_storage_01\00003039\80\00\00\e6.doc'
OK
API> link,c,,/Temp
OK
API> save,c,
Now look for a document named "Restored Document" in the /Temp cabinet. If it is there, then you have successfully recovered the deleted document!

Note:
- Add an event dm_destroy in the audit trails
- Stop dm_clean and dm_DMFilescan jobs which will instead clear contents of orphaned objects on scheduled basis
- select * from dm_audittrail where event_name='dm_destroy'
o this will give the details like ‘who,when,where deleted, object name’
- select * from dmr_content where any parent_id is null and set_time >= DATE(Today)
o this has the list of all the deleted documents on that day

No comments: