Uredi

Deli z drugimi prek


Mount-SPStateServiceDatabase

Attaches an existing state service database to the farm.

Syntax

Mount-SPStateServiceDatabase
     [-Name] <String>
     [-AssignmentCollection <SPAssignmentCollection>]
     [-DatabaseCredentials <PSCredential>]
     [-DatabaseServer <String>]
     [-ServiceApplication <SPStateServiceApplicationPipeBind>]
     [-Weight <Int32>]
     [<CommonParameters>]

Description

The Mount-SPStateServiceDatabase cmdlet attaches an existing state service database to the farm. If the session state database schema is not installed in the state service database, use the Initialize-SPStateServiceDatabase cmdlet to install the schema after the state service database has been mounted.

For permissions and the most current information about Windows PowerShell for SharePoint Products, see the online documentation at SharePoint Server Cmdlets.

Examples

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

Mount-SPStateServiceDatabase -Name "statedata1" -DatabaseServer "localhost"

This example associates a SharePoint Server farm with a SQL Server database.

This example is used in least privilege scenarios when an administrator cannot create databases in SQL. The database must already exist and be empty. The database cannot be used until the Initialize-SPStateServiceDatabase cmdlet is run, so errors could occur with this example.

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

Mount-SPStateServiceDatabase -Name "statedata1" -DatabaseServer "localhost" -ServiceApplication "ServiceApp1" -Weight 10 | Initialize-SPStateServiceDatabase

This example associates a SharePoint Server farm with a SQL Server database, at the same time that it also associates the database with a service application and gives a weight of 10. The result is immediately piped to the Initialize-SPStateServiceDatabase cmdlet so that the database can be used.

Parameters

-AssignmentCollection

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.

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.

Type:SPAssignmentCollection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-DatabaseCredentials

Specifies the database credentials for SQL Authentication used to access the state service database. If this parameter is not specified, Windows authentication is used.

The type must be a valid PSCredential object.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-DatabaseServer

Specifies the name of the host server for the state service database.

The type must be a valid SQL Server host name; for example, SQLServerHost1.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Name

Specifies the database name that is created in the SQL Server database.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-ServiceApplication

Specifies the state service application to which to add the state database.

The type must be a valid name of a state service application (for example, StateServiceApp1); a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; or an instance of a valid SPStateServiceApplication object.

Type:SPStateServiceApplicationPipeBind
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition

-Weight

Specifies the weight for the state database used to load balance the allocation of new data. The default value is 1.

The type must be a valid integer in the range of 1 to 10.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Server Subscription Edition