Introduction
A very cool aspect of SharePoint’s implementation is the mechanism by which it ghosts pages, that is, stores pages altered with FrontPage in the _site database so they are available to all of the web servers in the server farm.
The Problem
However, because ghosted pages alter the way in which custom assemblies are loaded by SharePoint, it is undesirable to have a page ghosted for no reason, such as adding a DataView web part in FrontPage (something that does not require a ghosted page). Also, ghosted pages will not be affected by template charges so they can make it difficult to rebrand a site. System admins generally get tasked with cleaning up these pages.
The Fix
This solution is primarily targeted to systems admin who want to un-ghost many pages in one shot.
- Open SQL Enterprise Manager
- Navigate to the _SITE database that corresponds to the site WSS or portal site you want to clean up.
- Open the Docs table in Query mode
- Create a query of the form: SELECT DirName, LeafName, ContentFROM DocsWHERE LeafName = N’default.aspx’ AND Content IS NOT NULLThis query lets you see which pages will be affected. You can further constrain the potential changes by adding more conditions to the DirName field in the Where clause. Just make sure to use the full not relative path in the filter:
SELECT DirName, LeafName, Content
FROM DocsWHERE LeafName = N’default.aspx’ AND Content IS NOT NULL AND DirName = N’/Topics’ - The last step is to change the query to an Update query and set the Content field to null. This is where the ghosted content lives:
UPDATE Docs
SET Content = NULL
WHERE LeafName = N’default.aspx’ AND Content IS NOT NULL AND
DirName = N’/Topics’
Actually, when a page is put into the database, it’s getting “unghosted”, not “ghosted”. “Ghosted” is when the filesystem-based template is shared.
And things are much easier to do when making use of the GhostHunter web part available in the Web part toolkit from http://www.bluedoglimited.com 🙂
[Patrick Tisseghem]
This comment has been removed by a blog administrator.
Hello,
i want to ask some thing i am searching a lot, may be you can help me.
I have Site with subsites on SP2003
the subsites uses customize template, i migrated the site to MOSS2007 the main site is ok but subsites are not there at all.
I found in presacn log that all subsites which use custom template are unghosted pages. So can you tell me what to do with this issue.
thanks
Muhammad, I went through the same thing with a previous client of mine. We ended up simply reverting the unghosted pages back to their respective site definitions. In the short term, we lost the customizations but the site was functioning properly. We later recreated some of the customizations using new techniques available in MOSS 2007. We ended up with a much more maintainable site that way. Hope this helps you.
Erm, can’t you just use the Reghost switch in STSADM?
Modifying the SQL database direct is unsupported.
SharePoint V2 / 2003 did not have a Reghost switch on stsadm.