Question Status

Verified
Vanessa Shin asked a question on 10 Apr 2014 8:56 PM

Dear All,

How do I configure automatic kill an idle session in NAV 2013? Or I have to write query in SQL Management Studio? Any solution on it?

Thousand thanks for any help.

Best Regards,

Shin

Reply
Verified Answer
Daniele Rebussi responded on 10 Apr 2014 11:40 PM

You can achieve it adding the ClientServicesIdleClientTimeout parameter in CustomerSettings.config file (format :[dd.]hh:mm:ss[.ff] where dd = days, hh = hours, mm = minutes, ss = seconds and ff = hundredths of seconds) or schedule a SQL job like this:

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_KillIdleSpids]') and

OBJECTPROPERTY(id, N'IsProcedure') = 1)

drop procedure [dbo].[sp_KillIdleSpids]

go

create procedure [dbo].[sp_KillIdleSpids]

as

declare

--@sec int=null,

--@diff int,

@spid int,

@cmd char(255),

@loopcount int

set @loopcount=( select count(s.spid) as count1 from master..sysprocesses s

where program_name LIKE '%NAV%'

and ((select DATEDIFF(SS,s.last_batch,GETDATE()))>180) ) --180 = no. of seconds

while @loopcount!=0

begin

set @spid=(select top 1 s.spid

from master..sysprocesses s where program_name LIKE '%NAV%'

and ((select DATEDIFF(SS,s.last_batch,GETDATE()))>1))

set @cmd=convert(char(4), @spid)

exec( 'kill ' +@cmd);

SET @loopcount =@loopcount-1

end

Reply
Verified Answer
Alex Chow responded on 11 Apr 2014 12:17 PM

For NAV 2013, do the following:

1. Run the Microsoft Dynamics NAV Administration

2. Click on the service running the NAV application

3. Modify the Idle Client Timeout

4. Save and restart the NAV service.

No modifications or SQL scripts needed.

Reply
Verified Answer
Daniele Rebussi responded on 10 Apr 2014 11:40 PM

You can achieve it adding the ClientServicesIdleClientTimeout parameter in CustomerSettings.config file (format :[dd.]hh:mm:ss[.ff] where dd = days, hh = hours, mm = minutes, ss = seconds and ff = hundredths of seconds) or schedule a SQL job like this:

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_KillIdleSpids]') and

OBJECTPROPERTY(id, N'IsProcedure') = 1)

drop procedure [dbo].[sp_KillIdleSpids]

go

create procedure [dbo].[sp_KillIdleSpids]

as

declare

--@sec int=null,

--@diff int,

@spid int,

@cmd char(255),

@loopcount int

set @loopcount=( select count(s.spid) as count1 from master..sysprocesses s

where program_name LIKE '%NAV%'

and ((select DATEDIFF(SS,s.last_batch,GETDATE()))>180) ) --180 = no. of seconds

while @loopcount!=0

begin

set @spid=(select top 1 s.spid

from master..sysprocesses s where program_name LIKE '%NAV%'

and ((select DATEDIFF(SS,s.last_batch,GETDATE()))>1))

set @cmd=convert(char(4), @spid)

exec( 'kill ' +@cmd);

SET @loopcount =@loopcount-1

end

Reply
Verified Answer
Alex Chow responded on 11 Apr 2014 12:17 PM

For NAV 2013, do the following:

1. Run the Microsoft Dynamics NAV Administration

2. Click on the service running the NAV application

3. Modify the Idle Client Timeout

4. Save and restart the NAV service.

No modifications or SQL scripts needed.

Reply
Vanessa Shin responded on 14 Apr 2014 7:38 PM

Thanks Daniele & Alex.

Reply