Connect-SPConfigurationDatabase

适用于: SharePoint Foundation 2010, SharePoint Server 2010

上一次修改主题: 2015-03-09

将本地服务器计算机连接到服务器场。

Syntax

Connect-SPConfigurationDatabase [-DatabaseName] <String> [-Passphrase] <SecureString> -DatabaseServer <String> [-AssignmentCollection <SPAssignmentCollection>] [-DatabaseCredentials <PSCredential>]

详细说明

Connect-SPConfigurationDatabase cmdlet 可将当前服务器连接到指定的配置数据库。

实质上,此 cmdlet 是将服务器连接到服务器场。如果无法将当前计算机连接到服务器场,将显示如下错误消息:

“此计算机已经连接到 SharePoint 场。请参见: Dismount-SPConfigurationDatabase”

Parameters

参数 必需 类型 说明

DatabaseName

必需

System.String

指定要连接到服务器的配置数据库的名称。

类型必须为有效的数据库名称;例如,DB1。

DatabaseServer

必需

有效的数据库服务器,例如“DS”

指定要在其中创建配置数据库的服务器。默认值为本地计算机名称。

Passphrase

必需

System.Security.SecureString

指定用于将当前服务器连接到配置数据库的安全密码。

键入的值必须为有效的安全字符串;例如,MyBDCApp1serverkey。

AssignmentCollection

可选

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

管理对象以便正确进行处理。使用 SPWebSPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。在使用 SPWebSPSiteSPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。

注意Note
在使用 Global 参数时,所有对象均包含在全局存储中。如果未立即使用对象,或未通过使用 Stop-SPAssignment 命令来处理对象,则可能会发生内存不足的情况。

DatabaseCredentials

可选

System.Management.Automation.PSCredential

指定包含用于数据库 SQL 身份验证的用户名和密码的 PSCredential 对象。如果未指定此参数,将使用当前用户。

该类型必须是有效的 PSCredential 对象。

输入类型

返回类型

Example

------------------示例------------------

Connect-SPConfigurationDatabase -DatabaseServer "ServerName\InstanceName" -DatabaseName "SharePointConfigurationDatabaseName" -Passphrase (ConvertTo-SecureString "MyP@ssw0rd" -AsPlainText -Force 

Start-Service SPTimerv4

此示例使用名称 ServerName\InstanceName 和密码 MyP@ssw0rd 将本地服务器计算机加入到服务器场中,该服务器场配置为使用 SQL Server 实例上的数据库 SharePointConfigurationDatabase

See Also

Reference

Backup-SPConfigurationDatabase
Disconnect-SPConfigurationDatabase
Dismount-SPContentDatabase
New-SPConfigurationDatabase
Remove-SPConfigurationDatabase