Tuesday, December 2, 2008

V7: Manually removing orphaned content instances

PROBLEM
-------
You can't delete a content type although the VCM doesn't show any associated
content instances. This error message appears in a JavaScript pop-up box:

The following validation error(s) occurred:
Cannot remove a type that currently has instances

This problem can occur when content instances are still associated with the
content type, even though they are not visible in the VCM.

SOLUTION
--------
You must remove the orphaned content instances from the database manually:

1. To find the ID of the content type in the VgnAsObjectType table, perform
this SQL query:

Select ID,name,displayname from VgnAsObjectType

Find the ID that corresponds to the content type you are trying to delete.
The ID should end in ____ and look something like this:

ac798d60f58b5010VgnVCM100000af3410ac____

2. Perform this SQL query:

select contentmgmtid from vgnasmometadata
where objecttypeid='()';

The query will return the orphaned content instance or instances that are
causing the problem. Each ID should end in RCRD and look something like
this:

e8ed0bd758db5010VgnVCM100000af3410acRCRD

3. Back up the system database.

4. For each item returned in step 2, perform the following SQL:

delete from vgnAsMoMap where recordId='';
delete from vgnAsMoMetaData where contentMgmtId='';
delete from vgnAsExtObjAttribs where recordId='';
delete from vgnAsChannelFileAssociation where vcmObjectId='';
delete from vgnRecord where id ='';
delete from vgnCMSObject where id = '';
delete from vgnObjectBlob where obj = '' AND indexField = 0;
delete from vgnRecordKeyMap where recordId ='';
delete from vgnObjectNote where object = '';
delete from vgnDeploymentData where object = '';
delete from vgnObjectHistory where object = '';
delete from vgnObjectSnapshotSet where obj = '';
delete from vgnCMSObjectGroupObjectSet where obj ='';
delete from vgnAssociation where cmsObjectId ='';
delete from vgnReferenceMap where referrerId = '' or referentId = '';

5. If everything went well, commit.

6. Now you should be able to delete the content type from the VCM.

No comments: