Chris’s SharePoint Reflections

Just another WordPress.com weblog




  • Chris Zhong

    IT consultant Australia








Ghosted and unghosted in SharePoint

Posted by chrissyz on February 9, 2009

One of the most common problems we encountered in SharePoint solution deployment is: after we deployed the wsp file successfully to the farm, we found some pages got 404 page not found error, or they didn’t reflect the latest change or fix we put in our .wsp file. Why?

 OK, the most possible reason for that is the good old ghosting issue. Before we dive any further, let’s explain some fundamental concepts here.

Unghosted == customized. It happens when you customized a WSS/MOSS2007 site in SharePoint designer, or you add custom field to Doc Library or you customized a site through UI and save it as a site template and then create sites using that template. When you unghost a page, a customized version of it was saved in the content database. So next time when you request for the page, SPVirtualPathProvide will tell SharePoint that the page has been customized. Then SharePoint will retrieve the customized version of the page from the content database.

Ghosted= uncustomized. It means the site definition pages have not been customized and the pages in your site definition run directly from the file systems on your web server. When a page instance is initially provisioned from a page template, WSS doesn’t need to store a copy of it in the content database because WSS can load the page template from the file system of the web server and use it to progress any request for an uncustomized page instance. Therefore, when you request for a ghosted page, SharePoint uses a page template loaded into memory from the file system of the WFE. It eliminated the need to transfer the content of a page definition file from the SQL server computer with content database to the WFE.

Now, come to our initial problem. Woops, before that, I just need to make sure everyone understand the concept of solution deployment as well. What is solution deployment? Ok, you packaged the whole solution from Visual studio and produce a .wsp file. Then you deploy the .wsp file to your farm using STSADM command. A .wsp file is actually a .cab file. It contains all your files (master pages, page layouts, css, images, features, etc), your assemblies (web parts, web controls, event handlers, etc) and xml files that tell where to drop these things in the WFE. Will it drop anything into the content database? Absolute not. We should all bear in mind that SharePoint solution deployment only have impact on File Systems in WFE. It won’t touch SharePoint content database and configuration database. OK now we can finally go back to our original question. When you perform another solution deployment after your initial deployment (doesn’t matter it is re-tract and re-deployment or upgrade), you put all your new files/ fix into the file system. But if you have any unghosted (customized) Page, they still go through the content database to grab the customized version instead of going to the file system to grab the new version your just deployed.

So aha, now we know the problem. How we gonna fix it? The answer is simple, re-ghost it, changing the page from customized to un-customized.

There are two ways of doing it. One is through SharePoint UI

1. Go to Site Actions ->Site Settings ->Reset to Site definition

 unghosted-22

2. Click Reset to site definition, and enter the page URL. Or you can choose to reset all the pages in the particular site to site definition.

unghosted32

The other way is through SharePoint Designer 2007. It will also help you to track all the unghosted pages before and after deployment. Microsoft has two articles explaining how to track the unghosted pages and how to reset them from SharePoint designer I recommend checking if you have any unghosted pages in your current site before and after you deploy your new solution.

2 Responses to “Ghosted and unghosted in SharePoint”

  1. Cheng Wu said

    I am working on Project Server 2003 (WSS V2), when I prepare my site for upgrading to Project Server 2007 (WSS V3), the prescan.exe showed one unghosted page, how do I reset to site definition in WSS V2? (I tried to Apply theme to site under Site Settings and select No Theme(Default) and Apply, but it has no effect).

  2. Ben Gacud said

    Use Designer 2007.

Leave a reply to Cheng Wu Cancel reply