Backup restore site collection sharepoint

Backup restore site collection sharepoint is the mostly requested task for administrator. As an admin, you should know how to backup sharepoint site collection. When you need to migrate site collection from one environemnt to another environent Example Production to QA mostly, we follow the sharepoint back up restore method. It can be sharepoint content database backup restore method or only backup and restore site using powershell method.

Advertisements

sharepoint backup and restore site collection methods

There are different ways to back up site in sharepoint and restore to different infracture. We can follow content database back up and restore method. Follow the post below on the same.

https://atomic-temporary-119393429.wpcomstaging.com/dismount-mount-content-database-in-sharepoint-2019-using-powershell/

we can follow any one of the backup and restore methods in sharepoint, find below:

  • Backup site collection using central admin.
  • Backup site collection using powershell
  • Restore site collection using powershell
Advertisements

Backup site using central admin

Follow the step by step procedure to back sharepoint site using central admin method below:

  • Open “SharePoint Central Administration”
  • Click on “Backup and Restore” from left navigation.
  • Click on “Perform a site collection backup” present under “Granular Backup”.
  • Select “Site Collection” and enter backup file save path.
  • Select the check box “Overwrite existing file” so as to save and replace the existing file with same name.
  • proceed for click “Start Backup”.
Backup site collection using central admin
Advertisements
  • Backup process will start with message “A site collection backup is currently in progress” under “Granular Backup Job Status” page. You will see page as shown below.
Granular Backup Job Status
Advertisements
  • Click on “Refresh” to check the status in certain interval of time. You will see the completion status once done.
Granular Backup Job Status completed
Advertisements

Backup site using powershell

You can follow powershell command which comes under sharepoint backup and restore best practices. Follow the step by step procedure below:

  • Run “SharePoint 2019 Management Shell” as an Administrator.
  • Run the command “Backup-SPSite” as shown in code below.
Backup-SPSite http://win-q2repghf9du/sites/DevSite -Path "C:\backup\SharePoint\DevSite.bak" -Verbose
Advertisements

Restore site collection using powershell

Follow step by step procedure to restore site using powershell.

Identify the content database and respective DB server in which you are planning to restore by navigating “Manage Content Database -> Select web application -> Click on respective content database”.

attach content databases in web application sharepoint
manage content database settings
Advertisements
  • Run “SharePoint 2019 Management Shell” as an Administrator.
  • Run the command “Restore-SPSite” as shown in code below.
Restore-SPSite -Identity http://win-q2repghf9du:44179/ -Path C:\backup\SharePoint\DevSite.bak -DatabaseServer WIN-Q2REPGHF9DU -DatabaseName WSS_Content_WebApp -Force -Verbose
Advertisements

if you are passing url http://win-q2repghf9du:44179/, restored site collection will be a root site collection, as below.

restored root site collection sharepoint
Advertisements

if you are passing url http://win-q2repghf9du:27315/sites/DevSite, restored site collection will be created with same url, as below. This URL is the new site collection url as restored path.

Restore-SPSite -Identity http://win-q2repghf9du:27315/sites/DevSite -Path C:\backup\SharePoint\DevSite.bak -DatabaseServer WIN-Q2REPGHF9DU -DatabaseName WSS_Content_41dfb81a085a49b781b289e61fc4b037 -Force -Verbose
Advertisements
restore site collection in sharepoint
restoring site collection in sharepoint using powershell

Backup sharepoint online site collection

So as to take backup sharepoint online site collection, you need to contact microsoft support by creating a ticket.

Advertisements
Advertisements

move site collection to dedicate content database

We have to move site collection to dedicate content database when content database size growing too large. One content database present under a web application in SharePoint contains multiple site collections. We can create or add new content databases under web application when limit of maximum number of sites that can be created in this database exceed while creating new site collection. If one site collection present under a content database is growing large, user request to create a dedicate content database and move that particular site collection to another new content database. We need to follow the steps as described below to move site collection to dedicate content database.

Advertisements
  1. Get site collection GUID using powershell
  2. Get which content database site collection web application is stored
  3. Create new content database in SharePoint
  4. move site collection to different content database
  5. IISRESET SharePoint server
  6. Post Implementation testing
Advertisements

Get site collection GUID using powershell

Before you move site collection to another content database, get guid of sharepoint site. You can get site collection guid using powershell script as mentioned below.

$site=Get-SPSite http://win-q2repghf9du/sites/TeamSiteClassicRenamed
$siteguid=$site.id
echo $siteguid
get site collection guid powershell
Advertisements

Get which content database site collection web application is stored

Get site collection content database details including web application, site url using the powershell command below.

Get-SPSite | Where-Object {$_.Url -like "http://win-q2repghf9du/sites/TeamSiteClassicRenamed"} | select Url, ContentDatabase, WebApplication
content database in which site collection is stored

You can use the alternative command as described in my old post link below.

https://atomic-temporary-119393429.wpcomstaging.com/content-database-in-sharepoint/
Advertisements
Advertisements

Create new content database in SharePoint

I described in detail about how to create or add a new content database in SharePoint in my previous post. Follow the post linked below for more details and use the powershell script for creating content database.

https://sharepointtechnicalsupport.com/create-add-a-content-database-in-sharepoint-2019/
New-SPContentDatabase "WSS_Content_DB2" -DatabaseServer "WIN-Q2REPGHF9DU" -WebApplication http://win-q2repghf9du/ -MaxSiteCount 1 -WarningSiteCount 0
Create new content database in sharepoint using powershell
Advertisements
Advertisements
Content database in sql server
Advertisements

move site collection to different content database

Now we are ready to move site collections between databases using the powershell command Move-SPSite as described below.

Move-SPSite "http://win-q2repghf9du/sites/TeamSiteClassicRenamed" -DestinationDatabase "WSS_Content_DB2"
move site collection to dedicate content database
Advertisements
Advertisements

IISRESET SharePoint server

You will get a message in powershell window like “IIS must be restarted before this change will take effect. To restart IIS, open a command prompt window and type iisreset”. You have to do IIS reset SharePoint server.

iisreset
iisreset sharepoint server
Advertisements
Advertisements

Post Implementation testing

After move site collection to new content database completed, you can check GUID of the site collection again. Its same as source location.

check guid of site in sharepoint

check content database of site collection to cross check the new content database as destination location.

check content database of site collection
Advertisements
Advertisements
Advertisements
Advertisements

unattached content database recover contents list library

unattached content database – recover contents list library from is required while moving list or library as content migration. You can recover files from content database that is not attached to any web application in sharepoint 2019. Recovering data from content database unattached will restore only specific list library in sharepoint site. Follow the step by step procedure to recover list library from sharepoint content database not attached.

Advertisements
  • Navigate to central admin in sharepoint 2019.
  • Select “Backup and Restore” from left navigation and click on “Recover data from an unattached content database” present under “Granular backup”.
recover contents list library from unattached content database
Advertisements
  • Select “Database Server”.
  • Select “Database Name” which is unattached to any web application.
  • select the radio button “Export site or list”, if you want to export list or library from unattached content database.
  • Choose radio button “Backup site collection” to export site collection from content database unattached.
recover files from content database that is not attached
Advertisements
  • Select site collection present in the unattached content database.
  • choose site from the site collection selected above.
  • Select list or library that you want to recover or restore.
select site list library in sharepoint from contact database unattached
Advertisements

After that, follow the same procedure described in previous post “export import list library sites in sharepoint” to import list or library described once export is completed.

Import-SpWeb -Identity "site url in which you want to import list" -Path "exported item saved location" -IncludeUserSecurity -UpdateVersions Overwrite -verbose

Import-SpWeb -Identity "site url in which you want to import library" -Path "exported item saved location" -IncludeUserSecurity -UpdateVersions Overwrite -verbose
Advertisements

watch the video to get in detail step by step

Advertisements
Advertisements