共用方式為


Admin.SetDatabaseTimeout 方法

設定 Project Server core 資料庫,在 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
)

參數

  • timeout
    類型:System.Int32

    內部 SQL 呼叫次數核心的 Project Server 資料庫中指定逾時 (以秒為單位)。

備註

秘訣秘訣

在某些 Project Server 部署中,預設資料庫逾時不足夠。如果因 SQL 逾時錯誤而失敗的 Project Server 工作,管理員可使用SetDatabaseTimeout方法,來增加資料庫逾時設定,並再試一次此工作。

預設值和最小值是 30 秒。最大值為Int32最大,或是 2147483647 秒 (超過 15 年)。

若要設定專案佇列或時程表佇列的 SQL 命令逾時,您可以使用SetQueueConfiguration方法,或使用 [佇列設定] 頁面上Project Web App (https://ServerName/ProjectServerName/_layouts/pwa/Admin/queuesettings.aspx) 中。

Project Server 權限

權限

描述

ManageServerConfiguration

可讓使用者管理 Project Server 的組態資訊。通用權限。

ManageSiteServices

可讓使用者管理服務,例如 Active Directory 設定] 及 [資料庫逾時。通用權限。

範例

若要使用下列Windows PowerShell指令碼,將儲存在名為 csv 檔案,例如組 DatabaseTimeout.ps1的指令碼。執行SharePoint 2010 管理命令介面( 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."
    }
}

請參閱

參照

Admin 類別

Admin 成員

WebSvcAdmin 命名空間