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.

  1. Open SQL Enterprise Manager
  2. Navigate to the _SITE database that corresponds to the site WSS or portal site you want to clean up.
  3. Open the Docs table in Query mode
  4. 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’

  5. 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’