Connect-SPConfigurationDatabase

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

语法

Default (默认值)

Connect-SPConfigurationDatabase
    [-DatabaseName] <String>
    [-SkipRegisterAsDistributedCacheHost]
    [-Passphrase] <SecureString>
    -DatabaseServer <String>
    [-AssignmentCollection <SPAssignmentCollection>]
    [-DatabaseCredentials <PSCredential>]
    [-DatabaseFailOverPartner <String>]
    [-LocalServerRole <SPServerRole>]
    [<CommonParameters>]

说明

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

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

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

有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet

示例

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

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

参数

-AssignmentCollection

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

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

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

参数属性

类型:SPAssignmentCollection
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DatabaseCredentials

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

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

键入的值必须是有效的 PSCredential 对象。

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-DatabaseFailOverPartner

适用:SharePoint Server 2016,SharePoint Server 2019

指定SQL Server实例的数据库镜像伙伴。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DatabaseName

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

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

键入的值必须为有效的数据库名称;例如,DB1。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:1
必需:True
来自管道的值:True
来自管道的值(按属性名称):False
来自剩余参数的值:False

-DatabaseServer

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

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

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-LocalServerRole

适用:SharePoint Server 2016,SharePoint Server 2019

指定分配给本地服务器的 MinRole。

参数属性

类型:SPServerRole
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Passphrase

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

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

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

参数属性

类型:SecureString
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:9
必需:True
来自管道的值:True
来自管道的值(按属性名称):True
来自剩余参数的值:False

-SkipRegisterAsDistributedCacheHost

适用:SharePoint Server 2010、SharePoint Server 2013、SharePoint Server 2016 SharePoint Server 2019

默认情况下,服务器场中的所有服务器均注册为缓存主机(即,默认情况下运行 DistributedCacheService )。

使用此参数不会将服务器计算机注册为分布式缓存主机。 如果要具有专用缓存主机,则使用此参数可确保计算机上不安装缓存服务。

参数属性

类型:SwitchParameter
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:10
必需:False
来自管道的值:True
来自管道的值(按属性名称):True
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters