Question

I have a backup of content database (*.bak) file. I have one web application running it now. However I have restored it again under different name on my SQL Server. I would like to create another web application using a copy of the same content database. It however comes up with an error

"The attach operation cannot continue because another object in this farm already contains the same ID. Each object in a farm must have a unique ID. In order to proceed with the attach operation you must assign a new ID to this database. To attach this database with a new ID, use the Mount-SPContentDatabase command with the -AssignNewDatabaseId parameter. Note that if this new database and an existing database contain the same site collections, attaching this database will likely result in orphaned site collections due to conflicts between the two databases."

  • I have tried using -AssignNewDatabaseId however when It attached my content database it was showing that there are 0 Current Number of Site Collections.

  • I thought it might be good idea to change existing content's database GUID so that I can create new web application with backup.

Is that even possible?

Was it helpful?

Solution

Luke,

First of all never change anything inside a SharePoint Content Database. Concerning the "0" number of site collections it may happen due to permissions and conflict of internal SID for the dbo user for a restored content database.

Here is what can you do and it should work just fine provided that your content database is not exceeding 15GB.

  1. Take a stsadm -o backup "webappurl" -filename "yoursitecolleciton.bak"

  2. Create a new web application and create a site collection at the root.

  3. Restore the backup with -overwrite option. SharePoint takes care of the rest and your sites should work just fine from there on both web applications.

Incase your content database is fairly large in size around 100 GB in that case you need to follow these below steps:-

  1. Restore the content database to a different farm of the version.

  2. Rename the content base on the restored farm's SQL Server by taking the database offline.

  3. Attach the renamed content database to the farm.

  4. Use -AssignNewDatabaseId to this database.

  5. Take a SQL Backup of the content database from there on.

  6. Restore this content database backup on your current farm and attach it it to the second web application.

Try this and let us know if you encounter any issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top