#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Disconnect all idle connections


    How can I disconnect all idle connections from Firebird?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2008
    Posts
    55
    Rep Power
    6

    Thumbs up


    http://www.firebirdfaq.org/faq64/

    How to disconnect the user connection?

    Currently there is no easy way of doing it. You can bring database to some of shutdown modes, but it affects all users. If you use Classic you can (with some effort) find the users process by detecting the IP address and open database files of that process and simply kill that process. With Super Server it is not possible as the connection is run in a thread of multithreaded SuperServer process.

    There are plans for future versions of Firebird to address this. For example, version 2.1 introduces ability to cancel running queries (by deleting the relevant records from MON$STATEMENTS table).

    If you just want to take the database offline for maintenance (all users disconnected), you can take database to a shutdown mode using gfix and then rename the database file, so that nobody can connect, not even by chance. On Windows, you won't be able to rename the database file while in use. On Linux, you need to check manually whether the file is in use by using 'fuser' or 'lsof' command. Make sure you run those as 'root' user, as ordinary users cannot detect files opened by other accounts.

    See the SYSTEM TABLES (hided) for MON$???????
    http://ibexpert.net/ibe/index.php?n=Doc.SystemObjects


    http://tech.groups.yahoo.com/group/firebird-support/message/86663

    Last edited by emailx45; July 9th, 2013 at 11:38 AM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2006
    Location
    Plovdiv. Bulgaria
    Posts
    226
    Rep Power
    12
    From Firebird 2.5 you can use :
    Code:
    DELETE FROM MON$ATTACHMENTS WHERE MON$ATTACHMENT_ID something
    to disconnect different connections from the database.

IMN logo majestic logo threadwatch logo seochat tools logo