Restore Content Database using power shell

1.Create a new Central Administraton Content Database

New-SPContentDataBase -Name Sharepoint_AdminContent -WebApplication http://win-idc918bbhd0:8003/

2.Get a list of Central Administration Content DataBase

Get-SPWebApplication -Identity http://win-idc918bbhd0:29852 | Get-SPContentDatabase | Select id, Name,

WebApplication|Format-List

Get-SPWebApplication -Identity http://win-idc918bbhd0:8003 | Get-SPContentDatabase | Select id, Name,

WebApplication|Format-List
3.Copy Database Content:
Get-SPSite -ContentDatabase [old databaseid GUID]| Move-SPSite -DestinationDatabase [new database id

GUID]
Get-SPSite -ContentDatabase aa4e76db-6307-4484-9afc-6a70c4eaba39| Move-SPSite -DestinationDatabase

aa4e76db-6307-4484-9afc-6a70c4eaba39


4.Delete the old database
Remove-SPContentDatabase [old database id GUID]

Remove-SPContentDatabase 3eb947a3-7ee6-4e11-ba0f-7d565735fd5c

5.Confirm the old database has been removed form sharepoint
Get-SPWebApplication -Identity http://win-idc918bbhd0:29852/
| Get-SPContentDatabase | Select id, Name, WebApplication|
Format-List

Mount-SPContentDatabase aa4e76db-6307-4484-9afc-6a70c4eaba39 -DatabaseServer WIN-IDC918BBHD0\Sharepoint

-WebApplication http://win-idc918bbhd0:8003

stsadm -o addcontentdb -url http://win-idc918bbhd0:8003 -databasename WSS_Content_SGP_Portal -

databaseserver WIN-IDC918BBHD0\Sharepoint

Comments

Popular posts from this blog

Sites.Selected | Graph API SharePoint Permission

Configure the SharePoint Online App Catalog

Azure Function | Sharepoint List item | Call from Power Automate Flow