Friday 3 January 2020

Error during Content DB Mount and Dismount - SharePoint


o    Stated tried moving the central admin to other server and they wanted to run PSCONFIG, so they dismounted all the DB's.

o    After PSCONFIG was successfully, trying to mount the db.’s, where they are getting below error. Error while mounting the DB:

Mount-Spcontentdatabase: An item with the same key has already been added

o    We checked with Get-spcontentdatabase, list of attached DBS, we found there was no content db. present in that list 'Test_DB001' which is trying to attach.

o    We collected the web application id by below command

get-spwebapplication | select name, id

o    We ran the below query on SQL end to find the orphan GUID

select * from dbo.Objects where id = GUID '

o    Found around 85 orphan databases.

o    We ensured with you if they have good known backup of the content database, you confirmed they have.

o    We ran the below command to check if the Orphan GUID getting deleted

$wa = Get-SPWebApplication ABC

$wa.ContentDatabases.Delete(GUID)

o    We checked with SQL query and compared, found above Orphan guid were deleted.

$guids ="…"

ForEach($guid in $guids){

$wa.ContentDatabases.Delete($guid)

}

o    Ran the above script successfully and took results of the SQL Query (select * from dbo.Objects where id = GUID)

o    We tried to mount the content database 'Test_DB001'  and successfully mounted the DB.




No comments:

Post a Comment