SharePoint 2013 – Rename or move Search Service Application databases
SharePoint 2013 – Rename or move Search Service Application databases
These are the required steps to rename or move the databases from your SharePoint Search Service Application: (TechNet Article)
- Pause the SharePoint Search Service Application
Important: The Search service application must be paused until after the databases are restored in the new location and the service is pointed to the moved databases.
- Set all search databases to read-only
This is necessary to prevent new database transactions during the backup and restore process.
- Back up the Search service application databases but do not resume the Search service application.
- Enable the max degree of parallelism to 1 in the new SQL Server.
- Restore the Search service application databases to the new location.
- Point the Search service application to the moved databases.
- Resume the Search service application.
Step1:
# Pause Search Service Application $ssa = Get-SPEnterpriseSearchServiceApplication <SearchServiceApplicationName> Suspend-SPEnterpriseSearchServiceApplication -Identity $ssa
For Step2 – Step5 see TechNet Article.
Step6:
# Point the Search Administration database to the new location. At the Windows PowerShell command prompt, type the following commands: $ssa = Get-SPEnterpriseSearchServiceApplication <SearchServiceApplicationName> $ssa | Set-SPEnterpriseSearchServiceApplication [-DatabaseName "<NewDbName>"] -DatabaseServer "<NewServerName>"
Important: See Set-SPEnterpriseSearchServiceApplication issue in September 2016 CU KB3118289
When you run the Set-SPEnterpriseSearchServiceApplication cmdlet, you receive the following error message:
An item with the same key has already been added.
This issue occurs after you restore the search service application database.
Error Message:
Set-SPEnterpriseSearchServiceApplication : An item with the same key has already been added.
At line:2 char:8
+ $ssa | Set-SPEnterpriseSearchServiceApplication -DatabaseName “SharePoint_Search …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Offic…viceApplication:SetSearchServiceApplication) [Set-SPEnterpriseSea
rchServiceApplication], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Office.Server.Search.Cmdlet.SetSearchServiceApplication
# Point the Analytics Reporting database to the new location. At the Windows PowerShell command prompt, type the following commands: Add-SPServerScaleOutDatabase -ServiceApplication $ssa -DatabaseServer <NewServerName> [-DatabaseName <NewDbName>] $temp = Get-SPServerScaleOutDatabase -ServiceApplication $ssa Remove-SPServerScaleOutDatabase -Database $temp[0] -ServiceApplication $ssa # Point the Crawl database to the new location. At the Windows PowerShell command prompt, type the following commands: $CrawlDatabase0 = ([array]($ssa | Get-SPEnterpriseSearchCrawlDatabase))[0] $CrawlDatabase0 | Set-SPEnterpriseSearchCrawlDatabase [-DatabaseName "<NewDbName>"] -DatabaseServer "<NewServerName>" # Point the Link database to the new location. At the Windows PowerShell command prompt, type the following commands: $LinksDatabase0 = ([array]($ssa | Get-SPEnterpriseSearchLinksDatabase))[0] $LinksDatabase0 | Set-SPEnterpriseSearchLinksDatabase [-DatabaseName "<NewDbName>"] -DatabaseServer "<NewServerName>" # Set all Search service instances to Online. Run the following commands for each search service in the farm, until the Search service instance is reported as Online. At the Windows PowerShell command prompt, type the following commands: Get-SPEnterpriseSearchServiceInstance -Identity <Search Server> Do {write-host -NoNewline .;Sleep 10; $searchInstance = Get-SPEnterpriseSearchServiceInstance -Identity <Search Server>} while ($searchInstance.Status -ne "Online") # Resume the Search service application. At the Windows PowerShell command prompt, type the following commands: $ssa = Get-SPEnterpriseSearchServiceApplication <SearchServiceApplicationName> Resume-SPEnterpriseSearchServiceApplication -Identity $ssa # Restart each server that hosts a search component.