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?

有帮助吗?

解决方案

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
$serviceApplication.Update() 
许可以下: CC-BY-SA归因
scroll top