Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Killing an Idle Session Automatically in NAV 2013

(0) ShareShare
ReportReport
Posted on by 2,560

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

*This post is locked for comments

  • Csiak Gyula Profile Picture
    25 on at
    RE: Killing an Idle Session Automatically in NAV 2013

    Hi there,

    In my case, this query only finds the service tiers connecting to SQL Server and Classic Clients, which directly connect to the database, but not clients with RTC-connection through service-tier. Any suggestions, how I can query the clients' list with idle time for using the STOPSESSION command under a codeunit? I am using NAV 2017, thanks in advance!

    Best regards,

    Gyula

  • Vanessa Shin Profile Picture
    2,560 on at
    RE: Killing an Idle Session Automatically in NAV 2013

    Thanks Daniele & Alex.

  • Verified answer
    Alex Chow Profile Picture
    4,481 on at
    RE: Killing an Idle Session Automatically in NAV 2013

    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.

  • Verified answer
    Daniele Rebussi Profile Picture
    2,480 on at
    RE: Killing an Idle Session Automatically in NAV 2013

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,865 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans