When a SharePoint farm is setup it creates a content database for the central admin site with a default name SharePoint_AdminContent_<GUID>. There would be situations where the database has to be renamed to adhere to company naming policies or for better manageability using automated scripts. The process of renaming SharePoint 2010 content database can be achieved with few lines of PowerShell Script
Create a new content database for SharePoint central admin site
First step is to create a new content database for the SharePoint 2010 central admin site using the New-SPContentDatabase cmdlet
New-SPContentDatabase -Name <DatabaseName> -WebApplication <URL of SharePoint central admin site>
Get GUID of the content database for SharePoint central admin site
Get-SPContentDatabase PowerShell cmdlet will give the name and id of the content database.
The syntax is
Get-SPContentDatabase –WebApplication <URL of Central admin site along with port number>
This will list the old content database and the new content database.Copy the GUIDs of the databases in notepad or similar application.
Move the sites from old content database to new
Get-SPSite cmdlet will give the sites in a content database and Move-SPSite cmdlet will move sites to a particular content database. We can use combination of these cmdlets to move the SharePoint 2010 central admin content database.
Get-SPSite –ContentDatabase {GUID of old content database} |
Move-SPSite -DestinationDatabase {GUID of new content database}
No comments:
Post a Comment