none
Attach CurrentSiteCount 0 when it should be 1

    Question

  • I've BAKed and copied a db from production to dev and restored it to a new db, and attached it to a new application using

    mount-spcontentdatabase -Name WSS_Content_DBTEST -Webapplication http://sitename:1234

    Went fine, except I'm getting

    CurrentSiteCount : 0

    when it should be 1.

    Checked WSS_Content_DBTEST in sql with SELECT * FROM Allsites and it's returning one row with ID.

    Tried adding it through the CA UI and same result. Tried stsadm, same.

    I've run into this before, but using MOSS, and I can't remember what I did to fix it. Any tricks?

    Thanks,

    Scott

    Thursday, September 26, 2013 7:22 PM

Answers

  • I had the same issue and i know how painful it was because my site collection was 150GB.

    Changing the DB guid will not fix the issue because SiteCollection GUID still same.

    You can do one easy test to see if your db working.....Detach the other DB from sharepoint and then attach the new one, i hope you will see the site now.

    Solution: What i did: I took the Sharepoin backup(Not DB BackUp) of the sitecollection via pwoershell and restore it via powershell. his way its crate a new GUID for the Site collection.

    Hope this help

    thanks

    -ws


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010)

    Thursday, September 26, 2013 10:08 PM

All replies

  • This can happen if the same site collection already exists in production.  Each SC has a GUID and that GUID must be unique across the entire farm.

    Are your farms running the same build ((Get-SPFarm).BuildVersion)?


    Trevor Seward, MCC

    Follow or contact me at...
      

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Thursday, September 26, 2013 7:33 PM
    Moderator
  • Thanks Trevor. You might be on to something.

    I have two DBs on the dev server that are, for intents and purposes, the same. THey're both BAKed from the same production site. So, when I tried to attach, I got an ID error and had to add -AssignNewDatabaseId to my initial Mount-SPContentDatabase attempt. It went through no problem, but also gave me a site count of 0 instead of 1.

    Thursday, September 26, 2013 8:57 PM
  • I had the same issue and i know how painful it was because my site collection was 150GB.

    Changing the DB guid will not fix the issue because SiteCollection GUID still same.

    You can do one easy test to see if your db working.....Detach the other DB from sharepoint and then attach the new one, i hope you will see the site now.

    Solution: What i did: I took the Sharepoin backup(Not DB BackUp) of the sitecollection via pwoershell and restore it via powershell. his way its crate a new GUID for the Site collection.

    Hope this help

    thanks

    -ws


    Thanks -WS SharePoint administrator, MCITP(SharePoint 2010)

    Thursday, September 26, 2013 10:08 PM