I am in the process of refreshing a dev farm from production. Typically I do this with database migration approach. I treat services DB's the same as the content DB's. I will take a backup of the database in production SQL and then restore the DB in Dev and go through the mount process (for content DB) and recreate the service with the restore name of the DB for the services. This works great for the content DB and the Managed Metatdata, but the Search is not happy at all. I thought I have used this process in the past on search, but it just is not doing what I expect.

When I create the search service with the existing database, I get the error that the Database contains User-defined schema already.

I decided to simplify my testing and I create a completely new/fresh Search service and deleted the search service, leaving Data intact, I run the powershell to create the search service with those DB's and I got the same error.

I have cleared SP Config cache, restarted the server, etc.

Any thoughts?

  • Usually I see 'user-defined schema existed' is when some managed properties are mapped already, such as refinablestring, refinabledate, refinable.......I will take a look of those properties and makes sure they are "clean"
    – YogaPanda
    Feb 15, 2018 at 20:26
  • They do exist. That is one of the main reason I want to move search from prod to dev instead of a "clean" search. I have an analyst that created the search managed properties and I don't have documents on what was created. I figured it would be easier to just move the databases instead of manually rebuilding the properties. It would be no different that this point as if I was doing Disaster planning and needed to rebuild what I had. I should not have to manually rebuild all the managed properties. Feb 15, 2018 at 21:14
  • So I'm hoping you are using SP13+ (13/16/O365) If so, you can export search configuration instead of manually map them by yourself. So first get a clean search, import back the search configuration, things will be there. Otherwise the error messages will always be there.
    – YogaPanda
    Feb 15, 2018 at 21:37
  • Another thing is IDK whether your dev and prod are the same version but I guess they are. If they are different version, the amount of refinable-properties are different based on various version.
    – YogaPanda
    Feb 15, 2018 at 21:40
  • I forgot to mention, when you export the search configuration it export everything in to that XML file. Including but not limiting to Query Rules, Schema, Search Sources, etc.
    – YogaPanda
    Feb 15, 2018 at 21:43

1 Answer 1


You cannot just supply the database name with the Search Service Application. You have to create a new Search Service Application (SSA) by using the Restore-SPEnterpriseSearchServiceApplication cmdlets and supply the name of your Search Admin database. The other databases will be created for you. This will restore all your Farm and Site Collection level Search Settings like Managed Properties and Result Sources. It does not restore the topology, it creates a simple topology that you can clone and adjust as needed following the restore. The applies to databases from the current of n-1 version of SharePoint.

Tip: the -Name parameter will become the database name "prefix" so avoid spaces etc. Also, if you have a custom Thesaurus you will need to restore that separately.

Restore-SPEnterpriseSearchServiceApplication on Microsoft Docs

To rename the SSA use the following. I use a variable called Search Stub for the database name.

$serviceApplication = Get-SPServiceApplication | where {$_.Name -eq $searchDBStub}
$serviceApplication.Name = $serviceApplicationName
  • I actually thought I had the "Restore" command in there the entire time and not the "New". I must have copied a different script originally than I thought. This was exactly what was missing. Thank you Feb 16, 2018 at 16:29
  • yuck, it is using the "service service name" for he DB's, not the DBName provided (at least my test system in 2013 has that result) Feb 16, 2018 at 20:43
  • 1
    Right, so do the restore using the name you want for the resulting DBs and then rename the service application. Feb 16, 2018 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.