Export (0) Print
Expand All
3 out of 5 rated this helpful - Rate this topic

Restore-SPSite

Published: May 12, 2010

Restores a site collection.

Restore-SPSite [-Identity] <String> -Path <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-ContentDatabase <SPContentDatabasePipeBind>] [-Force <SwitchParameter>] [-GradualDelete <SwitchParameter>] [-HostHeaderWebApplication <String>] [-WhatIf [<SwitchParameter>]]
Restore-SPSite [-Identity] <String> -Path <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-DatabaseName <String>] [-DatabaseServer <String>] [-Force <SwitchParameter>] [-GradualDelete <SwitchParameter>] [-HostHeaderWebApplication <String>] [-WhatIf [<SwitchParameter>]]

Parameters

1

Parameter

Required

Type

Description

Identity

Required

System.String

Specifies the URL location to which the site collection is restored.

A site collection does not have to already exist at the URL location to perform a restore. However, you must specify a valid URL location that a site collection can be created. If a site collection already exists at the specified URL location, you must specify the Force parameter to overwrite it.

The type must be a valid URL, in the form http://server_name/sites/site_name.

Path

Required

System.String

Specifies a valid path to the location of the backup. For example, C:\Backup\site_name.bak.

AssignmentCollection

Optional

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

noteNote:

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

ContentDatabase

Optional

Microsoft.SharePoint.PowerShell.SPContentDatabasePipeBind

Specifies the SQL Server content database where the site collection data will be stored. If no content database is specified, the content database with the greatest unused site collection capacity and whose database status is ready will be used.

Force

Optional

System.Management.Automation.SwitchParameter

Specifies that the existing site collection at the URL location is to be overwritten by this restoration.

GradualDelete

Optional

System.Management.Automation.SwitchParameter

Specifies that the site collection being overwritten with the Force parameter should be gradually deleted over time by a timer job instead of all at once, which reduces its impact on SharePoint 2010 Products and SQL Server performance. This option is recommended for large site collections.

HostHeaderWebApplication

Optional

System.String

A valid URL assigned to the Web application by using alternate access mapping, such as http://server_name

Restores a site collection as a host-named site collection instead of a path-based site collection. When the HostHeaderWebApplication parameter is present, the value of the Identity parameter is the URL of the host-named site collection and the value of the HostHeaderWebApplication parameter is the URL of the Web application that will hold the host-named site collection.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

2

Parameter

Required

Type

Description

Identity

Required

System.String

Specifies the URL location to which the site collection is restored.

A site collection does not have to already exist at the URL location to perform a restore. However, you must specify a valid URL location that a site collection can be created. If a site collection already exists at the specified URL location, you must specify the Force parameter to overwrite it.

The type must be a valid URL, in the form http://server_name/sites/site_name.

Path

Required

System.String

Specifies a valid path to the location of the backup. For example, C:\Backup\site_name.bak.

AssignmentCollection

Optional

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

noteNote:

When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

DatabaseName

Optional

System.String

Specifies the SQL Server content database where the site collection data will be stored. If no content database is specified, the content database with the greatest unused site collection capacity and whose database status is ready will be used.

The type must be a valid database name, in the form SQLDB1.

DatabaseServer

Optional

System.String

Specifies the name of the SQL Server containing the content database specified by the DatabaseName parameter.

The type must be a valid database server name, in the form SQLBE1 and needs to be used in conjunction with the DatabaseName parameter.

Force

Optional

System.Management.Automation.SwitchParameter

Specifies that the existing site collection at the URL location is to be overwritten by this restoration.

GradualDelete

Optional

System.Management.Automation.SwitchParameter

Specifies that the site collection being overwritten with the Force parameter should be gradually deleted over time by a timer job instead of all at once, which reduces its impact on SharePoint 2010 Products and SQL Server performance. This option is recommended for large site collections.

HostHeaderWebApplication

Optional

System.String

A valid URL assigned to the Web application by using alternate access mapping, such as http://server_name

Restores a site collection as a host-named site collection instead of a path-based site collection. When the HostHeaderWebApplication parameter is present, the value of the Identity parameter is the URL of the host-named site collection and the value of the HostHeaderWebApplication parameter is the URL of the Web application that will hold the host-named site collection.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

Detailed Description

This cmdlet contains more than one parameter set. You may only use parameters from one parameter set, and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet Parameter Sets.

The Restore-SPSite cmdlet performs a restoration of the site collection to a location specified by the Identity parameter. A content database may only contain one copy of a site collection. If a site collection is backed up and restored to a different URL location within the same Web application, an additional content database must be available to hold the restored copy of the site collection.

Important Important:

The SharePoint 2010 Service Pack 1 (SP1) upgrade process alters the schema of all content databases. Because of these changes, you might need to take additional steps to restore a backup that you made before the farm was upgraded to SP1 to the farm after it is upgraded to SP1. For more information about doing this, see Restore pre-SP1 backups to an SP1 farm (SharePoint Server 2010) or Restore pre-SP1 backups to an SP1 farm (SharePoint Foundation 2010).

Return Types

 

----------------------EXAMPLE 1----------------------

Restore-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak

This example restores a site collection from the backup file C:\Backup\site_name.bak to the site collection URL http://server_name/sites/site_name.

----------------------EXAMPLE 2----------------------

Restore-SPSite http://server_name/sites/site_name -Path C:\Backup\site_name.bak -Force -DatabaseServer SQLBE1 -DatabaseName SQLDB1

This example restores a site collection backup from the backup file C:\Backup\site_name.bak, but overwrites the existing site collection at http://server_name/sites/site_name while specifying that the site collection must be stored in a specific content database.

----------------------EXAMPLE 3----------------------

Restore-SPSite http://www.example.com -Path \\file_server\share\site_name.bak -HostHeaderWebApplication http://server_name

This example restores a site collection backup from the backup file \\file_server\share\site_name.bak to the host-named site collection http://www.example.com on the Web application http://server_name.

Change History

 

Date Description Reason

May 12, 2010

Initial publication

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.