Admin.SetDatabaseTimeout 方法
将 Project Server 核心数据库的 SQL 超时设置以秒为单位。
命名空间: WebSvcAdmin
程序集: ProjectServerServices(位于 ProjectServerServices.dll 中)
语法
声明
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Admin/SetDatabaseTimeout", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Admin/", _
ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Admin/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Sub SetDatabaseTimeout ( _
timeoutType As DatabaseTimeoutType, _
timeout As Integer _
)
用法
Dim instance As Admin
Dim timeoutType As DatabaseTimeoutType
Dim timeout As Integer
instance.SetDatabaseTimeout(timeoutType, _
timeout)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Admin/SetDatabaseTimeout", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Admin/",
ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Admin/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void SetDatabaseTimeout(
DatabaseTimeoutType timeoutType,
int timeout
)
参数
timeoutType
类型:WebSvcAdmin.DatabaseTimeoutTypeProject Server 2010中提供的唯一值是Core常量 (值 = 0),它指定核心数据库。
timeout
类型:System.Int32指定内部对核心 Project Server 数据库的 SQL 调用超时值 (以秒计)。
备注
提示
在某些 Project Server 部署中,默认的数据库超时值不够。如果 Project Server 作业失败由于 SQL 超时错误,管理员可以通过使用SetDatabaseTimeout方法中,增加数据库超时设置,然后重试作业。
最小值和默认值为 30 秒。最大值是Int32最大或 2147483647 秒 (超过 15 年)。
若要设置 SQL 命令项目队列或时间表队列的超时值,可以使用SetQueueConfiguration方法,或使用Project Web App (https://ServerName/ProjectServerName/_layouts/pwa/Admin/queuesettings.aspx) 中的队列设置页。
Project Server 权限
权限 |
说明 |
---|---|
允许用户管理 Project Server 的配置信息。全局权限。 |
|
允许用户管理服务 (如 Active Directory 设置和数据库超时。全局权限。 |
示例
若要使用以下Windows PowerShell脚本,保存在文件命名,例如,设置 DatabaseTimeout.ps1中的脚本。运行SharePoint 2010 Management Shell中以管理员身份 (开始菜单的Microsoft SharePoint 2010 项目文件夹中) 中,导航到保存设置 DatabaseTimeout.ps1 文件的目录,然后键入以下命令,例如,若要设置为 60 秒的超时值: .\Set-DatabaseTimeout 60
###############################################################################
## Set-DatabaseTimeout
## Uses the Admin web service of the PSI to call the SetDatabaseTimeout method.
## The script user must have Project Server administrator permissions.
## To run on your Project Server installation, change the $pwaUrl value.
## Argument:
## Integer secTimeout -- Timeout in seconds, 30 to 2147483647 (15+ years).
## Example:
## .\Set-DatabaseTimeout 1800
## -- Sets the database timeout to 1800 seconds (30 minutes).
################################################################################
param([int]$secTimeout)
Set-StrictMode -version 2.0
$pwaUrl = "http://jcorbin8/pwa"
$svcAdminUrl = $pwaUrl + "/_vti_bin/PSI/Admin.asmx?wsdl"
[int]$timeoutType = 0
[bool]$runtimeErr = $false
[bool]$argErr = $false
if ($secTimeout -eq $null)
{
$argErr = $true
}
else # Validate the timeout value.
{
if ($secTimeout -lt 30 -or $secTimeout -gt 2147483647)
{
$argErr = $true
}
}
if ($argErr)
{
Write-Host "Usage:`tSet-DatabaseTimeout timeoutSeconds"
Write-Host "`t`tTimeout minimum = 30; maximum = 2147483647 (over 15 years)"
Write-Host "Example, to set 30 minutes: `n`t`t.\Set-DatabaseTimeout 1800"
exit
}
$c = Get-Credential
try
{
# Create a proxy for the Admin web service.
$svcAdminProxy = New-WebServiceProxy -uri $svcAdminUrl # -credential $c
$svcAdminProxy.SetDatabaseTimeout($timeoutType, $secTimeout)
}
catch [System.Web.Services.Protocols.SoapException]
{
Write-Host "A SoapException occurred."
$runtimeErr = $true
}
catch [System.Net.WebException]
{
Write-Host "A WebException occurred."
$runtimeErr = $true
}
catch
{
Write-Host "An error occurred."
$runtimeErr = $true
}
finally
{
if (-not $runtimeErr)
{
Write-Host "Success! Set the core SQL database timeout value to $secTimeout seconds."
}
}