PS C:\Users\admin> $db.ChangeDatabaseInstance("DBNAME")
Exception calling "ChangeDatabaseInstance" with "1" argument(s): "An update
conflict has occurred, and you must re-try this action. The object SPServer
Name=SERVERNAME was updated by admin, in the powershell (2572)
process, on machine SERVERNAME. View the tracing log for more information
about the conflict."
At line:1 char:1
Solution: Clear the Cache
Run the below script
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
Stop-Service SPTimerV4
$folders = Get-ChildItem C:\ProgramData\Microsoft\SharePoint\Config
foreach ($folder in $folders)
{
$items = Get-ChildItem $folder.FullName -Recurse
foreach ($item in $items)
{
if ($item.Name.ToLower() -eq "cache.ini")
{
$cachefolder = $folder.FullName
}
}
}
$cachefolderitems = Get-ChildItem $cachefolder -Recurse
foreach ($cachefolderitem in $cachefolderitems)
{
if ($cachefolderitem -like "*.xml")
{
$cachefolderitem.Delete()
}
}
$a = Get-Content $cachefolder\cache.ini
$a = 1
Set-Content $a -Path $cachefolder\cache.ini
Exception calling "ChangeDatabaseInstance" with "1" argument(s): "An update
conflict has occurred, and you must re-try this action. The object SPServer
Name=SERVERNAME was updated by admin, in the powershell (2572)
process, on machine SERVERNAME. View the tracing log for more information
about the conflict."
At line:1 char:1
Solution: Clear the Cache
Run the below script
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
Stop-Service SPTimerV4
$folders = Get-ChildItem C:\ProgramData\Microsoft\SharePoint\Config
foreach ($folder in $folders)
{
$items = Get-ChildItem $folder.FullName -Recurse
foreach ($item in $items)
{
if ($item.Name.ToLower() -eq "cache.ini")
{
$cachefolder = $folder.FullName
}
}
}
$cachefolderitems = Get-ChildItem $cachefolder -Recurse
foreach ($cachefolderitem in $cachefolderitems)
{
if ($cachefolderitem -like "*.xml")
{
$cachefolderitem.Delete()
}
}
$a = Get-Content $cachefolder\cache.ini
$a = 1
Set-Content $a -Path $cachefolder\cache.ini