Monday, August 5, 2013

Resolving Missing References when upgrading to SharePoint 2010

When doing some migrations from SP 2007 to SP 2010 there are some issue we commonly find in Test-SPContentDatabase command.

Please find the some of the common issues we see in report and the workaround for the issues and also solutions for the same.

Missing Site definition:Log entry : Sites in database {} has reference(s) to a missing site definition,
Id = {}, Lcid = {}. Remedy: The site definitions with Id {} is
referenced in the database {}, but is not installed on the current
farm. The missing site definition may cause upgrade to fail. Please install any
solution which contains the site definition and restart upgrade if necessarySQL query to fetch the details :
select fullurl from webs where webtemplate = {Template id from the above error message}Resolution : Try to open the sites url got from the above query and see if site works as expected if not delete site and perform the migration.

Missing Features : Log entry : Database {} has reference(s) to a missing
feature: Id = {}. Remedy: The feature with
Id {} is referenced in the database {}, 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.SQL query to fetch the details :
select fullurl, description from features join webs on (features.webid =
webs.id) where featureid = { Feature ID }Resolution : Open the Url and see all the feature related files were placed in the new envrionment if not place all the feature related files on all the WFE servers. If still problem persists deactivate the feature and perform the migration. Then insall the same feature in new environment separately.

Missing Setup File

Log Entry:
File {} is referenced [1] times in
the database {}, but is not installed on the current farm. Please
install any feature/solution which contains this file. Remedy: One or more setup
files are referenced in the database {}, but are not installed on the
current farm. Please install any feature or solution which contains these
files.SQL Query :
select * from AllDocs where SetupPath like
'%{ Path got from above error message}%'

Resolution : Mostly this issue will occur only when you try to perform a migration on a site collection / sub site which is not accessibly or corrupted sites. Please fix the issues in current site / sub site or delete the issue causing sites and perform migration.

Missing Web Part

Log Entry:
WebPart class
{} is referenced [1] times in the database
{}, but is not installed on the current farm. Please install any
feature/solution which contains this web part. Remedy: One or more web parts are
referenced in the database {}, but are not installed on the current
farm. Please install any feature or solution which contains these
webparts.SQL Query :
select s.fullurl, d.DirName, d.leafname, tp_ZoneID, tp_partOrder
from
webparts p
join alldocs d on (p.tp_PageUrlID = d.ID)
join sites s on
(s.id = p.tp_siteid)
where tp_WebPartTypeId =
‘{ WebPart ID from aove error message }’Resolution :
You can get the site that has the web part. You will usually
see that the web part does not render properly or says something about an error
for a particular web part. That is usually the issue. it can be a bit tricky if
everything looks ok though. In other words you may not see the issue on the site
though. The problem in this case is usually that someone has closed a web part
instead of deleting it.
There are two ways to delete the web parts.

Add a ?contents=1 to bring up the Web Part
Maintenance page. Click the ones that says Error and then click the Delete
button. Much simpler

To delete it you need to add it back to the page and then delete it. To add
them click the Add a web part button on one of the zones and
then click the Advanced Web Part galleryand
options link at the bottom right on the screen. Then in the Add
Web Parts panel that shows up on the page, click the Closed Web
Parts collection. The web parts that have errors will say (Web
Part Error) in the list of web parts before you add them.

NOTE: The query also has the zone id which tells you what zone it is in. This
is usually something life left, right, top, bottom, etc. You can use this to get
an idea of where on the page the web part is. The problem is that if it was
closed it appears to show the last zone it was part of instead of null or
something like that. Each zone can have multiple web parts. The order that they
are displayed is shown in the partOrder. 1 = first, 2 = second, etc.

Missing Assembly

Log Entry:
Assembly {} is referenced in the database
{}, but is not installed on the current farm. Please install any
feature/solution which contains this assembly. Remedy: One or more assemblies
are referenced in the database {}, but are not installed on the
current farm. Please install any feature or solution which contains these
assemblies.SQL Query :
SELECT s.fullurl, webs.fullurl, assembly, hostType
from
EventReceivers e
join webs on (e.webid = webs.id)
join sites s on (s.id
= e.siteid)
where Assembly = ‘{ webpart 4 part details from the above errror message}'

Comments:
I went to the url (that I got from the query above) and
investigated. I didn’t find that very useful. Then I looked at the hostType
column in the results and in my case had a value of 2. Which according to the Microsoft reference is for a list. So, I used SharePoint Manager to go to each of the lists for the site and
looked at the EventReceivers Property (Collection). You can then delete the
appropriate Event Receiver using Powershell. Do the deletion at your own risk. I
tried it on a copy of the content database and I didn’t see any adverse effects,
and I have read that others have done it also, but it seems a bit risky to me in
general. Try this on a copy of your content database before you do it on
production would be my recommendation. You can also use SharePoint Manager to
delete any hidden lists which have the EventReceiver. Again, use caution. If
this is not a show stopper, you may consider just leaving the issue alone. That
is what I did in my production environment since I was to chicken.

NOTE : I have taken some of the msdn references and also JustGeeks blog spot for the references for the solutions mentioned above and changed as per my personal experience on the same.