The below procedure was followed for one of the customers where an utility had unintentionally deleted off records from production system for documents which were older than a set number of years.
The customer had the backup of the Library Server (LS), Resource Manager (RM) and LBOSDATA directory, but restoring them directly would have wiped out the data which were added after the backup date.
Recreating the document again using the API would affect a lot of business logic as new Event Log entries would have been created and the system attributes like create date, modified date, etc. would also change.
Document deletion in IBM Content Manager
The deletion of documents in IBM Content Manager causes records to be immediately deleted from LS database and an entry is made into the ICMSTITEMSTODELETE table for later deletion from RM Database and LBOSDATA directory. The RMMigrator and RMPurger then use this information to delete the records from RM Database and LBOSDATA directory whenever their scheduled cycle starts.
Depending upon whether the RMMigrator and RMPurger service are started or stopped, the data restoration for Resource Manager Table and LBOSDATA may or may not be required in your case.
In our case, the customer had not started the RMMigrator and RMPurger service, so only the Library Server database records had to be restored and ICMSTITEMSTODELETE table needed to be cleared, while the RM table and LBOSDATA were intact.
In the below mentioned procedure, I have provided details for restoring data into LS, RM database and LBOSDATA. Please skip the RM database and LBOSDATA restoration steps if they have not been affected.
Procedure
NOTE: Depending on the features used in your Item Type, such as Reference Attribute, Child Components, etc. additional tables are going to be affected and the procedure for recovering from those is not provided here as part of the document. Here the default NOINDEX item type is used for the example. The procedure should work on IBM CM v8.3.x version and higher. If you need professional support contact your local IBM Lab Services.
Step 0:
Restore the databases (LS and RM) on a different instance of DB2 (Generally the existing default instance would be db2admin on Windows platform / db2inst1 on unix platform).
Stop all client applications connecting to IBM Content Manager.
Stop Resource Manager Application and its utilities (RMMigrator, Purger, etc.).
Take a fresh backup of the existing LS, RM database and LBOSDATA directory to ensure fallback in cause of issues with the procedure.
Follow the steps from 1 to 4 on the newly restored database and steps 5 to 8 on the existing database.
Step 1:
For a given item type name add a suffix of 001 to get the respective view name, Ex. for the NOINDEX Item Type, the view name would be NOINDEX001
Use the following query to get the underlying tables Item Type ID
db2 SELECT COMPONENTVIEWNAME, ITEMTYPEID FROM ICMSTCOMPVIEWDEFS WHERE COMPONENTVIEWNAME='NOINDEX001'
COMPONENTVIEWNAME ITEMTYPEID
------------------ -----------
NOINDEX1001 1007
Use the Item Type ID data from above output in the query below
db2 select COMPONENTVIEWNAME, ComponentTypeID from ICMSTCompViewDefs where
itemtypeid=1007
COMPONENTVIEWNAME COMPONENTTYPEID
------------------ ---------------
NOINDEX1001 1014
ICMParts1007001 1015
The underlying data tables for the Item Type are in the form ICMUT0XXXX001, so from the above result it would be ICMUT01014001 and ICMUT01015001
Apart from these tables, there are other standard tables such as ICMSTRI001001 (Reference Integrity Table), ICMSTITEMS001001 (Item Versions Table) and ICMUT00300001 (Base Table) from where the data for a document has to be extracted.
More details on these tables are available on ‘IBM Content Manager Info Center > Reference > System control tables’ section.(http://pic.dhe.ibm.com/infocenter/cmgmt/v8r4m0/topic/com.ibm.systemtables.doc/systemcontroltables.htm)
Step 2:
Using the ICMUT01015001, for a given itemid get the rtargetitemid using the query below, for example itemid='A1001001A13E13A82739B09289'
db2 select rtargetitemid from ICMUT01015001 where itemid='A1001001A13E13A82739B09289'
RTARGETITEMID
--------------------------
A1001001A13E13A82739B17487
Step 3:
Using now both the itemid and rtargetitemid, extract data from the following LS tables (replace the <itemid>, <rtargetitemid> and <filename> place holders below). Give distinct <filename> in the below command.
db2 export to <filename>.ixf of ixf select * from ICMADMIN.ICMUT01014001 where itemid=<itemid>
db2 export to <filename>.ixf of ixf select * from ICMADMIN.ICMUT01015001 where itemid=<itemid>
db2 export to <filename>.ixf of ixf select * from ICMADMIN.ICMSTRI001001 where sourceitemid=<itemid>
db2 export to <filename>.ixf of ixf select * from ICMADMIN. ICMSTITEMS001001 where itemid=<itemid>
db2 export to <filename>.ixf of ixf select * from ICMADMIN. ICMSTITEMS001001 where itemid=<rtargetitemid>
db2 export to <filename>.ixf of ixf select * from ICMADMIN.ICMUT00300001 where itemid=<rtargetitemid>
Step 4:
Using the rtargetitemid from above, extract data from the RM table
db2 export to <filename>.ixf of ixf select * from RMADMIN. RMOBJECTS where obj_itemid=<rtargetitemid>
Step 5:
Import the data that was exported from LS tables from the above steps
db2 import from <filename>.ixf of ixf messages <filename>.msg insert into ICMADMIN.ICMUT01014001
db2 import from <filename>.ixf of ixf messages <filename>.msg insert into ICMADMIN. ICMUT01015001
db2 import from <filename>.ixf of ixf messages <filename>.msg insert into ICMADMIN. ICMSTRI001001
db2 import from <filename>.ixf of ixf messages <filename>.msg insert into ICMADMIN.ICMSTITEMS001001
db2 import from <filename>.ixf of ixf messages <filename>.msg insert into ICMADMIN.ICMSTITEMS001001
db2 import from <filename>.ixf of ixf messages <filename>.msg insert into ICMADMIN. ICMUT00300001
Ensure that the restored itemid entries are not present in ICMSTITEMSTODELETE table and if it is present then delete it
db2 delete from ICMADMIN.ICMSTITEMSTODELETE where itemid=<itemid>
Step 6:
Import the data that was exported from RM tables from the above steps
db2 import from <filename>.ixf of ixf messages <filename>.msg insert into RMADMIN. RMOBJECTS
Step 7:
For the LBOSDATA directory, the documents can be directly merged from backup, with conflicting documents not to be overwritten.
Step 8:
Start the resource Manager application, search for the newly restored data using IBM CM Client for Windows or eClient application and then retrieve the document. If every part of the document data has been successfully restored you should be able to search and view the document along with its content.
This entire procedure can be automated by writing a small program with the above logic.
No comments:
Post a Comment