Tuesday, July 22, 2008

How to detect, repair and delete Orphan objects in SharePoint?

Category: Common Problems faced during Upgrade from SPS2003 to MOSS2007

Problem:
How to detect Orphan objects? How to remove or delete Orphans from the system?

Scenario:

We are doing Gradual upgrade approach for upgrading SPS 2003 to SharePoint 2007. During the root site upgrade, it failed saying that there are orphans in the sites.

Solution:

What is an Orphan Site?
An Orphaned Site is where SharePoint only has partial information and not a complete set of data for a given site collection in your Windows SharePoint Services or SharePoint Portal Server content databases or configuration databases. The site may in fact still be viewable via the browser, but you may notice that many things are broken. 99% of the cases I have seen though, the orphaned site is just unavailable.

How to detect Orphan Site?
To detect orphaned items, use the Stsadm command:

stsadm -o databaserepair -url http:// -databasename

This would return a XML with the orphan sites (if they exist) details as mentioned below:








Refer to ‘http://technet.microsoft.com/en-us/library/cc263282(TechNet.10).aspx’ for details on this stsadm command.


How to delete or remove orphan site?
To delete orphaned items, use the following stsadm command:

stsadm -o databaserepair -url http:// -databasename -deletecorruption

This command repairs corruption in the content database but sometimes it can’t remove corruption in the configuration database.

Here Spsadm tool comes into picture. Spsadm cleans up orphaned items in the configuration database in Sharepoint server 2003.

spsadm repairorphans http://Server1
Refer to ‘http://support.microsoft.com/kb/918742’ for more details on this command.

How to handle the worst kind of Orphan sites?

It happened to us in one of our upgrade phases. Our gradual upgrade was failing due to an Orphan site. We tried to repair the corrupted site using stsadm –databaserepair but it didn’t help. So I turned to SPSADM . That also didn’t help. The orphan site was not even getting deleted from the frontend.

So the only option was to somehow delete the site from the database. THOUGH THIS IS NOT A RECOMMENDED MICROSOFT APPROACH, we were left with only this option.

1) Find out the Site ID of the orphan site. You will get this from the orphan XML.
Check its entry in Webs table.
select * from webs where id = 'A7A18BB5-A483-4979-8038-0DA388CBC3E0'

For deleting an orphan site or web from the database, you have to delete its entry from webgroupmembership, webmembers & webs table, as shown below:

delete from webgroupmembership where webid= ‘A7A18BB5-A483-4979-8038-0DA388CBC3E0'

delete from webmembers where webid= ‘A7A18BB5-A483-4979-8038-0DA388CBC3E0'

delete from webs where id = 'A7A18BB5-A483-4979-8038-0DA388CBC3E0'

2) In our case, we had three orphan lists as well. You can see the lists in the xml (Output of stsadm –databaserepair command)

For deleting an orphan list from the database, delete its entry from Userdata, docs & aptb_lists sharepoint tables.

delete from aptb_lists where tp_id = '4202479A-706D-4416-ADCB-35410EAA7672' (corrupted List)

delete from aptb_lists where tp_id = 'B2A38B61-CC99-4528-A6B4-365019BB5B03' (corrupted List)

delete from aptb_lists where tp_id = 'FD65BF5F-D120-4A41-A2AB-63A6BA60C45' (corrupted List)

Similarly check for the list id entry in Docs & userdata and delete those entries from it.

***Either Stsadm -databaserepair or spsadm -repairorphans or deleting from database should solve the ORPHANED object problem for you.

Tuesday, July 15, 2008

How to update link between Recurring meeting workspace and the outlook meeting after SPS 2003 upgrade to MOSS 2007

Category: Common SPS2003 to MOSS upgrades issues:

Problem: When you migrate/ upgrade Recurring meetings, the data in the meeting workspace get migrated properly but the links between outlook calendar and the meeting workspace gets broken.

Scenario: This is a known issue with SharePoint upgrade. When you upgrade SharePoint, recurring meeting link with outlook gets broken. There is no way to directly update the link. The data in the recurring meeting workspace will be migrated. Also you would be able to see the old meeting in the outlook calendar but when you open the meeting, it will no longer be connected to the sharepoint meeting workspace. And it won’t allow you to even update the link.

Solution / Workaround: There is a Microsoft tool for exchange server which exposes the raw data of Outlook. Using this tool, you can again establish link with the migrated recurring meeting workspace.

Below are the steps on how to use this tool:

Step 1) Go To http://www.microsoft.com/downloads/details.aspx?FamilyID=55FDFFD7-1878-4637-9808-1E21ABB3AE37&displaylang=endownloads/details.aspx?FamilyID=55FDFFD7-1878-4637-9808-1E21ABB3AE37&displaylang=en

Click on ‘Download ‘and follow the setup. It will extract MFCMAPI files as shown in the figure 1














Figure 1


Step 2) Close your Outlook in case it is Open

Step 3) Click on ‘mfcmapi.exe’ à it will open up a window as shown in figure 2












Figure 2



Step 4) Click on OK on that window à Click on Session from the Menu à Click on ‘Logon and Display Store Table’ as shown in Figure 3







Figure 3


Step 5) Profile Name will automatically come as ‘Outlook’ à Click on OK
In the upper table, double click on “Mailbox - ” to open up a new window as shown in Figure 4















Figure 4


Step 6) On the tree in the left navigation menu, double click on ‘select Root – Mailbox à IPM_SUBTREE à Calendar’ as shown in the figure above. It will open up the calendar in new window as shown in the figure 5. Select the recurring meeting you want to relink.














Figure 5


Step 7) In the lower table, double click on the URL in the Value column as shown in the figure 6 and 7 below.











Figure 6
















Figure 7



Step 7) Change the URL of the workspace here and click on OK à Exit the window

Step 8) Open your recurring meeting. It has been linked to the new site URL of Step 7

Step 9) Note: the link on the outlook meeting will not change. Please delete the existing link and paste the new link into the outlook meeting body.


After doing this, the recurring meeting will be linked again! :-)