Adobe Content Services sometimes takes a lot of amount to delete a directory if there are a lots of nodes under the tree.
Suppose we need to delete Myapp node in the figure above. The conventional way to delete is through the Content Space UI. However, if the subtree rooted at Myapp is relatively large, it may take long time to delete the sub-tree.
A script has been written specifically for Oracle DB which helps in deleting the node in a definite amount of time. Here are the steps to be followed :
- Login to http://<server>:<port>/contentspace as administrator.
- Obtain the node-dbid for DataStore by logging into Content Space and traversing to Administration Console->Node Browser->Workspace://SpacesStore.Select “lucene” from the search dropdown and search with the following query : – @cm\:name:<Name of the space or folder where subtree is rooted> From the results table, click on the parent entry whose name is DataStore.From the Properties table get the value for “{http://www.alfresco.org/model/system/1.0}node-dbid” property.
- Stop the application server(shutdown all nodes in case of cluster). Delete the indices on the machine. Indices are present in lccs_data/lucene-indexes folder. In case of cluster, the indices need to be deleted on all the nodes separately.
- Open the PL-SQL procedure(given below) in an editor. Replace SCHEMA_PLACEHOLDER with the appropriate schema name.
- Following parameters are mentioned in the script 1)current node. Here, substitute the node-dbid mentioned in step 2 above. 2)delete_root ->Should the directory root be deleted. Pass 1 for deleting the root, else pass 0. 3) If the script running time is needed, pass 1 to the third parameter.
- Restart the application server where LiveCycle is installed.
- After the restart, the subtree will deleted
Caution:-
- A backup of the DB must be taken before running the procedure so that it is recoverable. This procedure gives a significant performance improvement over deleting the nodes via UI if the number of nodes is ~10000 or more.
- Company Home root node should not be deleted.Else it will render Content Services unusable.
Here is the script mentioned in the steps above:-
create or replace
PROCEDURE DeleteCSNodeTree (current_node NUMBER,delete_root NUMBER DEFAULT 0, print_time NUMBER DEFAULT 1)
IS
TYPE namelist IS TABLE OF NUMBER;
emp_cv SYS_REFCURSOR;
names namelist;
v_systimestamp TIMESTAMP;
BEGIN
if print_time >0 THEN
v_systimestamp := SYSTIMESTAMP;
DBMS_OUTPUT.PUT_LINE(‘Process started at ‘ || v_systimestamp);
END IF;OPEN emp_cv FOR
select child_node_id from SCHEMA_PLACEHOLDER.alf_child_assoc where parent_node_id = current_node;
FETCH emp_cv BULK COLLECT INTO names;
CLOSE emp_cv;
IF names.count > 0 THEN
FOR i IN names.FIRST .. names.LAST
LOOP
DeleteCSNodeTree(names(i),1,0);
END LOOP;
END IF;IF delete_root >0 THEN
delete from SCHEMA_PLACEHOLDER.ALF_NODE_ASPECTS where node_id =current_node;
delete from SCHEMA_PLACEHOLDER.ALF_NODE_PROPERTIES where node_id =current_node;
delete from SCHEMA_PLACEHOLDER.alf_child_assoc where child_node_id=current_node;
delete from SCHEMA_PLACEHOLDER.alf_node_assoc where source_node_id =current_node;
delete from SCHEMA_PLACEHOLDER.alf_node_assoc where target_node_id =current_node;
delete from SCHEMA_PLACEHOLDER.ALF_NODE where id= current_node;
END IF;if print_time >0 THEN
v_systimestamp := SYSTIMESTAMP;
DBMS_OUTPUT.PUT_LINE(‘Process ended at ‘ || v_systimestamp);
END IF;
END;
This should be noted that this script will work for Oracle DB. However, similar PL-SQL procedures can be written for other DBs as well.
1.
thanks thanks:) i usee now thanks for this information adobe.