Link to home
Start Free TrialLog in
Avatar of Arnold Layne
Arnold LayneFlag for United States of America

asked on

Content database has feature orphans

On the health monitor, under server side dependencies, I've received the following error that I'm sure people have seen before.

[MissingFeature] Database [WSS_Content] has reference(s) to a missing feature: Id = [6984f8e8-f991-4ae0-aa23-02a6cbf94a55], Name = [Feature Demo], Description = [], Install Location = [FeatureDemo]. The feature with Id 6984f8e8-f991-4ae0-aa23-02a6cbf94a55 is referenced in the database [WSS_Content], but is not installed on the current farm. The missing feature may cause upgrade to fail. Please install any solution which contains the feature and restart upgrade if necessary.

I also get an error under content databases, which seems to be caused by the same thing, orphaned features in the content database. I know how this happened but I'm not sure why.

I created a few features that weren't working even though they were installing and activating fine. I tried many install/activations and many uninstall/deactivations. I finally wiped everything out. First I deacativated all features (there were only about 4 that I created) and uninstalled them all and then even wiped out their feature folders in the features directory under SP root. Then i deleted the site collection and created a new one in it's place.

So it would appear that somehow, even if you do a proper deactivation first and then a proper uninstall, these don't really do what they advertise and apparently do not do their job by removing it's content database reference. I would rather not have to perfectly recreate these features with the exact original guids and reintroduce these folders back into the features folder

I ran stsadm -o databaserepair -url "https://myrootaddress.com" -databasename WSS_Content -deletecorruption

I don't believe I had any syntax errors because it ran for a few secs but it returned to the prompt with no output. Ran the reanalyze now for the error in Central admin and it's still shows up as an error. Restarted the iis, but it didn't help.

Has anybody else run into this really stupid problem maybe when they tried an upgrade??
Avatar of Arnold Layne
Arnold Layne
Flag of United States of America image

ASKER

I also went into the sql management studio, went to the features table, found the features that have the same id as the ones in the error message and deleted those rows. Stopped and restarted the SQL Server. Rebooted the entire server. Nothing was fixed, the same error messages show up in central admin.

Does anybody have any knowledge of this that actually works or do I have to do a complete uninstall? Everything I have researched flat out does not work as advertised. i can't believe that this is an unsolvable problem but with all of the recommendations I've found and tried, none of them work.
ASKER CERTIFIED SOLUTION
Avatar of Ted Bouskill
Ted Bouskill
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, touching the database was the only thing that seemed to work. The stsadm databaserepair with a -deletecorruption would run for a second or two, produce no output and then return to the prompt. I ran this three times. It seemed to do nothing because the orphaned features were still there, so as far as I'm concern, that command simply does not always do it's advertized job correctly and is faulty in some situations. Also what is faulty is the auto repair feature when viewing the error in Central Admin. Tech articles claim that this is how you fix the problem. They are wrong in my situation, it did absolutely nothing and was a useless feature in my case. I don't understand why things don't just work the way they are advertised, but this wouldn't be the first time an advertised Microsoft feature doesn't actually work correctly in all advertised situations.

One of the blogs you linked looks like what I should have done, remove -spFeaturefromContentDb, but I didn't know about that command and couldn't find an article that mentioned this. But why should this command ever need be run if the regular uninstall did it's job properly? So I went into the features table and one by one find the orphaned features by their id and remove their row. This didn't even work completely at first, only some of the offending orphans were removed from the error list in Central Admin. So I went back to the database, and found the entries that I swore I removed and removed them. Since a feature can be associated with many site ids, I had to find each instance of that feature for each of the site ids it belongs to, so there was more than one instance of the feature that had to be removed. So I probably manually did what remove -spFeatureFromContentDB does.

Anyway, it finally solved the problem manually, or at least according to the health analyzer it did, and everything seems to be working fine, but this is rather disgraceful that a problem has to be solved this way. If the install can add the entry to the content database and set up all the housekeeping correctly, then the uninstall should be able to completely undo everything the install does. Obviously, it does not clean up after itself, and leaves little messes behind.
I think remove -spFeatureFromContentDB mentioned in your link would have been the proper solution and would have done what I manually did, but it "appears" as though I did the manual removal operation correctly according to the health analyzer. But as you mentioned, this shouldn't be a recommended way to do this. It stil;l seems stupid that an install can add things to the content db, but doesn't remove them from the content db upon uninstall. Theoretically, remove -spFeatureFromContrentDb should never even need to be invoked, if the uninstalls worked properly.
I completely agree that there are some flaws with the install/uninstall process with features (and other items) in SharePoint and have been for years.  However, if you use the right search terms in search engines I guarantee someone else has run into it and find a solution.

I find those links in seconds using Google.  Sometimes it's a matter of using the right search terms and even trying another engine like Bing.  Bing seems to do better searching for Microsoft issues which is not a surprise.
Of course I searched a lot. The problem is that the only two answers I could find was the auto repair, which didn't work, and databaserepair which did not work as well. None of the articles I saw mentioned remove -spFeatureFromContentDatabase and they instead all said databaserepair. In fact, one article, from a Microsoft MVP even said that when all else fails, (and apparently all else can fail, maybe even often), go into the features table and manually remove the offending items. That's where I got the idea from, and apparently it did indeed work, although that's a really bad idea because I have no idea what sort of dependencies the record could have had. So I'm guessing that remove -spFeatureFromContentDb merely does exactly what I did and fortunately, nothing more. Luckily, it seems as though in the case of features, since it also has a site id column, then it would seem that any entries in the sites table have no dependencies to entries on the feature table and that it is the feature table entry that does the attaching to the site id, so feature records can be deleted without effecting site records. If something was wrong, I think I would start to see problems or at least strange ambiguities start to pop up, but now the site is actually, finally working perfectly. Even before the errors popped in the the health analyzer, I was having strange behavior such as successfully installing a feature that deploys a file, and then it successfully activates, but the file never shows up. Same problem with a content type I created, everything went fine but it would never show up in the content type list. Now they all do upon deactivation and activation. Weird stuff. I'm just a beginner teaching myself, so to have to run into very advanced problems like this from the beginning is very tough.
I hear you loud and clear.  Overall I've found lots of configuration issues with SharePoint that are the biggest pain point when administrating the farm.  For example, getting the Profile Service running is finicky because if you don't do it just right and have one misstep it fails.