Lock request time out period exceeded error

yasithyasith Member Posts: 30
edited 2015-07-14 in SQL General
Hi,

I'm trying to create NAV tenant (NAV 2015) using PowerShell in Windows Server 2012 environment.

When I execute HowTo-MoveCompanyToTenant script it gives following error;
Invoke-Sqlcmd : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
At D:\Sana Remote Installation Files\NAVTenantInstallation\AddCompanyTenant.ps1:300 char:9
+ Invoke-Sqlcmd -Database $FromDatabase -InputFile "G:\HowTo-MoveCompanyTo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
+ FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand


And windows event log says;
Lock request time out period exceeded.

In the PowerShell script, I have done following modification in-order to read HowTo-MoveCompanyToTenant.sql script.
......
Write-Verbose "Moving company ""$company"" from server/database (Tenant) $DatabaseServer/$FromDatabase ($OldTenantName) to new database/tenant $ToDatabase/$NewTenantName"
Write-Verbose "Creating company ""$company"""
New-NAVCompany -ServerInstance $ServerInstance -Tenant $NewTenantName -CompanyName $company

#Move the data from the old to the new company
Write-Verbose "Moving data"

$VariableArray = "Company=$company","FromDatabase=$FromDatabase","ToDatabase=$ToDatabase"
#$sqlFile = Join-Path $PSScriptRoot 'HowTo-MoveCompanyToTenant.sql'
#Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database $FromDatabase -InputFile $sqlFile -Variable $VariableArray -ConnectionTimeout 0

Invoke-Sqlcmd -Database $FromDatabase -InputFile "G:\HowTo-MoveCompanyToTenant.sql" -QueryTimeout 0 -ServerInstance $DBServerWithInstance -Variable $VariableArray

if ($RemoveCompanyWhenMoved)
{
Write-Verbose "Dropping old company"
Remove-NAVCompany -ServerInstance $ServerInstance -Tenant $OldTenantName -CompanyName $company -Force
}
........


Can anyone help me to sort out this issue.

Best regards,
Yasith

Comments

  • yasithyasith Member Posts: 30
    When I analyze event log, following message were there;
    Autogrow of file 'DynamicsNAV80_WS1962TestNAVTenantInstallation4' in database 'DynamicsNAV80_WS1962TestNAVTenantInstallation4' was cancelled by user or timed out after 153 milliseconds. Use ALTER DATABASE to set a smaller FILEGROWTH value for this file or to explicitly set a new file size.

    At that time my database auto growth percentage was 10%. So I changed that % into 5.
    After that installation process took a long time to execute, but still got the timeout error.

    Can some one advise me on this issue?
    :-k
  • davmac1davmac1 Member Posts: 1,279
    start off with a large enough database - data file and log file - to complete the process
Sign In or Register to comment.