My SharePoint Blog

Blogs On SharePoint Technologies


Search Site


My SharePoint Blog recommends any of the following books...


Recent comments

Tags

Don't show

    Categories


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    WSS Current Number of Sites 0 after SQL Restore of Content DB

    You restore a content db via SQL restore and attach it to another SharePoint web application via Central Administration "Add a content database" and for some reasone the "Current Number of Sites" is 0. WTF? You are sure the content db has content. In the Application Event Viewer you find the following error...

    Event Type:    Error
    Event Source:    Windows SharePoint Services 3
    Event Category:    Database 
    Event ID:    5763
    Date:        5/18/2007
    Time:        9:42:26 AM
    User:        N/A
    Computer:    TEAS-207
    Description:
    Primary key violation on SQL Server instance 'teas-207' in database 'SharePoint_Config'. Additional error information from SQL Server is included below.
    Violation of PRIMARY KEY constraint 'PK_SiteMap'. Cannot insert duplicate key in object 'SiteMap'.
    The statement has been terminated.
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    

     

    Here is the workaround. First find out the Id of the sites (site collection) in the [restored_db].Sites then delete the line in the [Config_db].SiteMap with the same Id. Now attach the content_db and you should see the sites.

    Categories: SharePoint
    Posted by Kevin on Friday, May 18, 2007 9:05 AM
    Permalink | Comments (13) | Post RSSRSS comment feed

    Comments

    gordon

    Monday, January 28, 2008 11:50 AM

    Kevin,

    I can't seem to find where to do this.

    Your solution sounds exactly what I am looking for, but I don't see those tables in any of the databases.
    thanks

    Kevin

    Monday, January 28, 2008 1:58 PM

    Try creating a site collection then detach the new content db and attache the old one.

    gordon

    Monday, January 28, 2008 2:02 PM

    Im sorry, but that is exactly what I am doing and is causing the problems

    Below is what I don't understand. I don't have any of those tables. where is the line called config_db.sitemap.

    Maybe I am missing something?

    Here is the workaround. First find out the Id of the sites (site collection) in the [restored_db].Sites then delete the line in the [Config_db].SiteMap with the same Id. Now attach the content_db and you should see the sites.

    Kevin

    Monday, January 28, 2008 2:29 PM

    Gordon, Check your email.

    Ali

    Thursday, March 27, 2008 3:04 AM

    Hi, my problem is same as GORDON, I do not know from where to start and where to find those tables and rows,please send me the steps on my email ASAP.

    Thanks in advance for your sharing.

    Gordon

    Thursday, March 27, 2008 8:00 AM

    MY issue was this. I had to restore some data that was deleted from an existing site a time previous to our deleted retention in sharepoint. I had to restore a backup copy to get that data. I tried to restore the database and site to the same server. I still had the old database connected and tried to restore the recovered database to the same server.

    Even if you give it a different name in the tables it is still looking at a unique site id. When you restore a site, it maintains that unique site id. YOU MUST Shut down the original site and disconnect it from the database before you bring up the restored site. Once I did that, it came up with a 1 site found and all was well. I spent many a day to figure that out. No one seemed to be able to give me a good answer on that one until I hit the right person.

    I hope this helps!!!

    Kevin

    Thursday, March 27, 2008 8:34 AM

    Thanks for the information Gordon!

    Macrel

    Friday, April 04, 2008 3:54 PM

    The above solution worked for me. To clarify:
    1) restore your content database from the backup file
    2) Using SQL Server Management Studio, look in your content database for table Sites and retrieve its data
    3) Take note of the Id column value
    4) Navigate to your Sharepoint configuration database; typically SharePoint_Config
    5) Goto table SiteMap and look for the row with the matching id value.
    6) Delete it.
    7) Attach your content database to your Site Collection via Central Admin.

    KB

    Tuesday, May 06, 2008 12:40 PM

    hey Gordon,
    Unfortunatly I have to to exctly the same thing ... but do not want to put my original site offline ...
    Have you fin an other solution ?
    Thanks a lot,

    KB

    Tuesday, May 06, 2008 12:49 PM

    Hi Gordon,
    Have you find an other solution without put the original site offline ... ?

    Thanks,

    Manh Le

    Thursday, July 31, 2008 3:24 PM

    Hello I did exactly what you said , but when I got to SQL 2005 and look up the ID column in the Sites Table , it read Id(uniqueidentifier,not null) , that was all I saw , I ddont see any value

    Can you help me
    THanks

    Manh Le

    Thursday, July 31, 2008 4:30 PM

    Hi , I ve figured it out ,but there is another problem

    In the Sites Table , I saw many many Values under ID Column , which one should I pick???
    THanks

    SB

    Tuesday, August 05, 2008 8:12 AM

    Hi KB...

    Can you please share your solution?

    Thanks!

    Add comment


     

    [b][/b] - [i][/i] - [u][/u]- [quote][/quote]



    Live preview

    Thursday, December 04, 2008 6:03 PM