Test-SPContentDatabase
测试内容数据库。
语法
Test-SPContentDatabase
[-Identity] <SPContentDatabasePipeBind>
[-AssignmentCollection <SPAssignmentCollection>]
[-DatabaseCredentials <PSCredential>]
[-ExtendedCheck]
[-ServerInstance <SPDatabaseServiceInstancePipeBind>]
[-ShowLocation]
[-ShowRowCounts]
[<CommonParameters>]
Test-SPContentDatabase
-Name <String>
-WebApplication <SPWebApplicationPipeBind>
[-AssignmentCollection <SPAssignmentCollection>]
[-DatabaseCredentials <PSCredential>]
[-ExtendedCheck]
[-ServerInstance <SPDatabaseServiceInstancePipeBind>]
[-ShowLocation]
[-ShowRowCounts]
[<CommonParameters>]
说明
此 cmdlet 包含多个参数集。 您可以只使用来自一个参数集的参数,也可以不合并来自不同参数集的参数。 若要详细了解如何使用参数集,请参阅 Cmdlet 参数集。
使用 cmdlet 可以针对 Web 应用程序测试内容数据库,以验证内容数据库中引用的所有自定义项是否也 Test-SPContentDatabase 安装在 Web 应用程序中。
此 cmdlet 可以对当前连接到服务器场的内容数据库发出,也可以对未连接到服务器场的内容数据库发出。
它可以用来从 SharePoint 2010 产品以及从 SharePoint 产品和技术测试内容数据库。
此 cmdlet 不会更改内容数据库的任何数据或结构,但可在检查进行期间导致数据库负载,从而暂时阻止使用 Test-SPContentDatabase 内容数据库。
此 cmdlet 应该只对当前使用率较低,或未在使用的内容数据库使用。
有关适用于 SharePoint 产品的 Windows PowerShell 的权限和最新信息,请参阅 SharePoint Server cmdlet。
示例
----------------------------示例 1-----------------------
Test-SPContentDatabase -name WSS_Content_DB -webapplication https://sitename
此示例针对 sitename Web 应用程序测试 WSS_Content_DB 内容数据库,并返回问题列表。
----------------------------示例 2-----------------------
$DB = Get-SPContentDatabase -site https://contoso.com
Test-SPContentDatabase $DB -showrowcounts
此示例获取包含位于 的网站集的内容数据库,然后针对承载该数据库的 Web 应用程序测试该数据库以确定 https://contoso.com 问题。 除了显示问题列表之外,因为指定了 ShowRowCounts 参数,所以此 cmdlet 还将从内容数据库返回表大小度量。
参数
指定包含要用于数据库 SQL Server 身份验证的用户名和密码的 PSCredential 对象。
键入的值必须是有效的 PSCredential 对象。
| Type: | PSCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
在数据库附加升级过程中检查不一致的身份验证模式。
在两个版本中,选定模式(声明模式或经典模式)必须相同。
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
以 GUID 或SharePoint名称的形式指定两个参数集之一的现有已连接内容数据库(如果是唯一的)。
| Type: | SPContentDatabasePipeBind |
| Position: | 1 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
指定要用来测试指定内容数据库的数据库服务的实例。
键入的值必须为有效的 GUID,如 12345678-90ab-cdef-1234-567890bcdefgh;SQL Server 实例的有效名称(例如,DBSvrInstance1);或者有效 SPDatabaseServiceInstance 对象的实例。
| Type: | SPDatabaseServiceInstancePipeBind |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
指定数据库中将使用缺少的模板和功能的位置。通常情况下,报告的位置限定在指定的内容数据库内的网站集中。
使用此参数会显著增加完成测试过程的时间。
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
返回数据库统计信息,在内容数据库的表中是指行计数。
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
指定要用来测试内容数据库的 SharePoint Web 应用程序。
键入的值必须为 12345678-90ab-cdef-1234-567890bcdefgh 形式的有效 GUID;SharePoint Web 应用程序的有效名称(例如,MyOfficeApp1);或者有效 SPWebApplication 对象的实例。
| Type: | SPWebApplicationPipeBind |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
指定要测试的现有内容数据库。
键入的值必须是有效的 SharePoint 内容数据库名称;例如,SPContentDB1。
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
管理对象以便正确进行处理。使用 SPWeb 或 SPSite 等对象可能会耗用大量内存,而且在 Windows PowerShell 脚本中使用这些对象需要正确管理内存。通过使用 SPAssignment 对象,可以将对象分配给变量,然后在不需要这些对象时对它们进行处理,以释放内存。在使用 SPWeb、SPSite 或 SPSiteAdministration 对象时,如果不使用分配集合或 Global 参数,则会自动处理这些对象。
在使用 Global 参数时,所有对象均包含在全局存储中。如果未立即使用对象,或未通过Stop-SPAssignment使用 Stop-SPAssignment 命令来处理对象,则可能会发生内存不足的情况。
| Type: | SPAssignmentCollection |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
| Applies to: | SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016, SharePoint Server 2019 |
反馈
提交和查看相关反馈