Udostępnij za pośrednictwem


Restore: Stsadm operation (Windows SharePoint Services)

Applies To: Windows SharePoint Services 3.0

 

Topic Last Modified: 2009-09-21

Operation name: Restore

Description

When the url parameter is used, a restoration of the site collection is performed. However, when the restoremethod parameter is used, a restoration of an individual database, Web application, or the entire farm can be performed. If you want to overwrite an existing site collection, use the overwrite parameter.

Syntax

For site collection restore

stsadm -o restore

**   -url <URL name>**

**   -filename <file name>**

**\[-hostheaderwebapplicationurl\] \<Web application URL\>**

**\[-overwrite\]**

For catastrophic restore

stsadm -o restore

**   -directory <UNC path>**

**   -restoremethod {overwrite | new}**

**\[-backupid\] \<GUID from backuphistory, see stsadm -help backuphistory\>**

**\[-item\] \<created path from tree\>**

**\[-percentage\] \<integer between 1 and 100\>**

**\[-showtree\]**

**\[-suppressprompt\]**

**\[-username\] \<user name\>**

**\[-password\] \<password\>**

**\[-newdatabaseserver\] \<new database server name\>**

**\[-preservechangelog\]**

**\[-quiet\]**

Parameters

Parameter Value Required? Description

url

A valid URL, such as http://server_name/sites/site_name

Yes

Specifies the URL to which the site collection backup should be restored.

filename

A valid file name for the site collection backup file, such as "Site_name.bak"

Yes

Specifies the path and name of the file that contains the backup of the site collection.

hostheaderwebapplicationurl

A valid URL assigned to the Web application by using Alternate Access Mapping (AAM), such as "http://server_name"

No

Restores a site collection as a host-named site collection rather than a path-based site collection. When the hostheaderwebapplicationurl parameter is present, the value of the url parameter is the URL of the host-named site collection and value of the hostheaderwebapplicationurl parameter is the URL of the Web application that will hold the host-named site collection.

overwrite

<none>

No

Overwrites an existing site collection currently at the location specified by the url parameter with the site collection stored in the backup file.

directory

Any one of the valid paths:

  • C:\folder_name

  • \\server_name\folder_name

Note

The spbr* folders are automatically created.

Yes

The path where Windows SharePoint Services 3.0 stores the catastrophic backup package generated during the stsadm -o backup operation. This is the parent folder of the spbr* folders.

If you have a computer that has Microsoft SQL Server 2005 and an instance of Windows SharePoint Services 3.0 installed, you can use local drive paths. This would include a basic installation. However, if SQL Server 2005 and Windows SharePoint Services 3.0 are installed on multiple computers, you must use Universal Naming Convention (UNC) share paths so that the SQL database and search components are read from the same location (for example, \\computer_name\volume\Backup). Multiple backup packages can be stored in the same location. This is the same path that you would pass to the -directory parameter of the stsadm -o restore operation.

restoremethod

Any one of the following:

  • overwrite

  • new

Yes

Specifies the type of farm restore to be performed, either overwrite or new.

The overwrite value restores the content and settings to their original location. This parameter is to be used only in a catastrophic restore within the same farm. If the overwrite value is used, a confirmation prompt is displayed. To suppress the prompt, use the suppressprompt parameter.

The new value specifies that the content will be restored to a new location and is intended to be used when restoring onto a different farm (for example, a new database server).

backupid

A valid GUID, such as "12345678-90ab-cdef-1234-567890abcdef"

GUID of the backup package that should be restored. Each backup package has a unique GUID associated with it and can be seen by viewing the backup history by using the stsadm -o backuphistory operation. If this parameter is absent, the most recent backup package will be used.

item

A valid item, such as:

  • Farm\Windows SharePoint Services

No

Indicates which part of the farm should be restored. You might use the full farm path notation as displayed by the -showtree parameter or the name of the target component in the path if it has a unique name. Surround the item or path in double quotation marks if it contains a space. If this parameter is absent, all items in the backup package will be restored.

percentage

An integer value between 1 and 100.

The default value is 5.

No

Requests the Restore operation progress updates to be displayed in increments of that percentage (for example, a value of "5" will display restore progress updates at 5 percent completed, and a value of "10" will display at 10 percent completed).

Note

This percentage is not precise and the actual progress updates might be lower or greater than requested.

For a very large database 1 is the optimal value that you should use to see some updates displayed.

The default value is 5.

showtree

<none>

No

Displays which items in the backup package would be restored based on all of the other parameters passed to the stsadm -o restore operation

Items that will be excluded from the restore based on the other parameters passed to the Restore operation will be preceded with an asterisk character. Items that cannot be selected for restore will be enclosed in square brackets ([ ]). A restore will not be performed if the showtree parameter is present

suppressprompt

<none>

No

Prevents the following command-line prompt from being displayed:

“Warning: All selected items will be overwritten. Do you want them to be overwritten (Y/N)?"

This parameter is valid only when the value of the restoremethod parameter is set to overwrite.

username

A valid SQL authentication user name in the form: username

No

Sets the same user name for all objects being restored that require a user name, including Web application pools. If an entire farm is restored, this parameter should only be used by farms using Windows authentication to connect to a database. If only a database is restored, then you may supply a SQL Server 2005 login name.

password

No

Sets the same password for all objects being restored that require a password, including Web application pools. If an entire farm is restored, this parameter should only be used by farms that use Windows authentication to connect to database. If only a database is restored, then you may supply a SQL Server 2005 login password.

newdatabaseserver

A valid database server name, such as "SQLBE1"

No

Indicates the instance name of SQL Server 2005 that should be used when restoring any databases when the value of the restoremethod parameter is new. This parameter is not valid when the value of the restoremethod parameter is set to overwrite.

By default, you are asked for a new database server name for each database.

preservechangelog

<none>

No

Preserves the change log so the next crawl of this content database is not a full crawl. This parameter was first introduced in the Infrastructure Update for Windows SharePoint Services 3.0. For more information, see Remarks.

quiet

<none>

No

Suppresses the output of restore progress information to the display window. The final restore status (“Operation completed successfully.”) will still be displayed. If the -quiet parameter is absent, the restore operation will display progress information to the display window as it restores the package.

Remarks

If you are running the Infrastructure Update for Windows SharePoint Services 3.0, the identifier (ID) of each content database is retained when you restore or reattach the database by using built-in tools. Default change log retention behavior when using built-in tools is as follows:

  • The change logs for all databases are retained when you restore a farm.

  • The change log for a content database is retained when you reattach the database.

  • The change log for a content database is NOT retained when you restore just the content database. It is in this case that you would use the preservechangelog parameter.

When a database ID and change log are retained, Search continues crawling based on the regular schedule defined by crawl rules. When a change log is not retained, Search performs a full crawl during the next scheduled crawl.

For more information, see Move content databases (Windows SharePoint Services 3.0) and Back up and restore the entire farm (Windows SharePoint Services 3.0 technology).

When you restore an existing database and do not use the restoremethod parameter with the overwrite option with the stsadm –o restore operation, a new ID is assigned to the restored database, and the database change log is not preserved. The next crawl of the database will fully index the content database.

If a restore is performed and the ID in the backup package is already in use in the farm (for example, you are attempting to split a database in two), a new ID is assigned to the restored database and a warning is added to the restore log. The ability to perform an incremental crawl instead of a full crawl is dependent on the content database ID being the same as before and the change log token used by search being valid for the current change log in the content database. If the change log is not preserved, then the token will not be valid and search will have to perform a full crawl.