次の方法で共有


Admin.SetDatabaseTimeout Method

Sets the SQL timeout for the Project Server core databases, in seconds.

Namespace:  [Admin Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/Admin.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/Admin.asmx?wsdl

Syntax

'Declaration
<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 _
)
'Usage
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
)

Parameters

  • timeout
    Type: System.Int32
    Specifies the timeout (in seconds) for internal SQL calls to the core Project Server databases.

Remarks

Tip

In some Project Server deployments, the default database timeout is not enough. If a Project Server job fails due to a SQL timeout error, an administrator can increase the database timeout setting by using the SetDatabaseTimeout method, and then retry the job.

The default value and the minimum value are 30 seconds. The maximum value is the Int32 maximum, or 2147483647 seconds (over 15 years).

To set the SQL command timeout for the Project queue or the Timesheet queue, you can use the SetQueueConfiguration method, or use the Queue Settings page in Project Web App (https://ServerName/ProjectServerName/_layouts/pwa/Admin/queuesettings.aspx).

Project Server Permissions

Permission

Description

ManageServerConfiguration

Allows a user to manage the configuration information for Project Server. Global permission.

ManageSiteServices

Allows a user to administer services such as Active Directory settings and database timeouts. Global permission.

Examples

To use the following Windows PowerShell script, save the script in a file named, for example, Set-DatabaseTimeout.ps1. Run the SharePoint 2010 Management Shell as an administrator (in the Microsoft SharePoint 2010 Projects folder of the Start menu), navigate to the directory where you saved the Set-DatabaseTimeout.ps1 file, and then type the following command, for example, to set the timeout value to 60 seconds: .\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."
    }
}

See Also

Reference

Admin Class

Admin Members

Admin Web Service