SPNote

SharePoint Notes

ReGhosting in SharePoint Server 2003 and WSS 2.0

SharePoint 2007 is my first SharePoint exprience and developed for it all the time but I moved to a new company and its Flatform is SharePoint Portal Server 2003 environments... The main reason I moved is a upcoming upgrade for SharePoint 2010.

but I'm frustrating at this moment. ㅠㅠ (crying...)

I was given a simple task which is to edit few javascript lines and I was doing on default.aspx files living in \60\TEMPLATE\1042\SPS??? directories. But SPSSITES directory is different than others and I looked on the url and found a url is different and it is /C9/SiteDirectory/Lists/List/Summary.aspx, not default.aspx.

With my SP 2007 knowledge, the url like /Lists/Summary.aspx means the page is from Database. So I opened the path using Map Network Drive (Open as Web Folder option is disappeared in IE 8) and edited it and the page is worked well. But!!! My colleague asked me how to do that??? She said, it is uncommon way here I want the old way back. I thought if I delete it from Web Folder, the page is coming from local drive again.

As someone SPS 2003 experts expects, a big problem happened!!! The summary.aspx page is gone and AllItems.aspx is displayed. After some walkaournds I could do, I realized nothing I can do at that time cause I'm new for it... I tried copying the Summary.aspx back to Web Folder and create views and ETC... and I started googling on this and found lots of info on Reghosting...

Unfortunately, reghosting is not my solution but I'm here to write on reghosting. I still have the problem to recover... (I'm installing SPS 2003 on my local PC now)
Googling on reghosting, they said "UPDATE Content to NULL from Docs table" and the way worked well. Because the MS has not mentioned on this, you sould use this carefully. One thing I'm a little satifisfied was the GhostHunter is using this way but this updates MetaInfo and MetaInfoSize columns more.

 

Directions are

  1. Connect to the SiteName_SITE database and open the Docs table
  2. Find the unghosted page
  3. Execute a sql statements which is to update Content, MetaInfo, and MetaInfoSize columns to NULL 

The SQL Query I used is

[code:tsql;ln=off]

-- Find Unghosted pages
SELECT SiteId, DirName, LeafName, MetaInfo, MetaInfoSize, Content
FROM Docs
WHERE LeafName = 'default.aspx'

-- Find Unghosted pages2 (If there are lots of records...)
SELECT SiteId, DirName, LeafName, MetaInfo, MetaInfoSize, Content
FROM Docs
WHERE SiteId = '9DAB8065-EA68-4021-BFEA-5A49D63540E2'
AND WebId = '77973AB7-EDB5-4D0E-BD55-17CC1F2C1C48'

-- UPDATE to Re-Ghost
UPDATE Docs
SET Content=NULL, MetaInfo=NULL, Size=0, MetaInfoSize = 13528
WHERE Id = '3BF58ADD-A7B2-4BB9-A255-D4B1FBF4BFE8'

[/code]

 

You need to get the size of file and Site and Web Ids. Main reason I used this is my condition that the docs table contains more than 1.6 million so that it is too slow. Here is the code to get Ids.

[code:c#;ln=off]

SPSite spServer = SPControl.GetContextSite(Context);
SPWeb spWeb = SPControl.GetContextWeb(Context);
Response.Write("Site ID: " + spServer.ID.ToString().ToUpper() + "<br />");
Response.Write("Web ID: " + spWeb.ID.ToString().ToUpper());

[/code]

 

The Columns whose value is chaged are

  1. Size MetaInfoSize
  2. Version
  3. DocFlags
  4. CharSet
  5. TimeLastModified
  6. NextToLastTimeModified
  7. MetaInfoTimeLastModified
  8. TimeLastWritten
  9. VersionCreatedSinceSTCheckout
  10. MetaInfo
  11. Content

 

After I deleted this Summary.aspx file, the record is disappeared and I found that coping the Summary.aspx file to the Web Folder created a new record with new Id. I still have the problem recovering the Summary.aspx. I tried many ways I could do such as set other columns and IISRESET, etc but I couldn't get a solution. So now I'm installing SPS 2003 to deep dive into it.