locked
Close all connection to Database RRS feed

  • Question

  • Hi,

    While restoring database,we have an option for closing all connection to database in interface

    I have searched for "closing all connection to database" using command But, I didn't get.Could you suggest me find out the command.

    Thanks,

    Yatheesha M

    software Engineer.

    E I connect trade advisory pvt ltd.

    Tuesday, August 2, 2016 7:54 AM

Answers

All replies

  • Hello,

    With ALTER DATABASE (Transact-SQL) => RESTRICTED_USER you can disconnect all non-admin Client Connections to the database 


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Tuesday, August 2, 2016 8:02 AM
  • Greetings Yatheesh,

    To my knowledge, there is no command to kill all connection as i can imagine it would be fairly useless:
    The reason it would be fairly useless due to the buildin reconnect-mechanismes in alot of connectors to avoid permenantly losing connections after a hick-up.

    So if you run the command you're asking for; it will be a split second untill most applications have reconnected again.

    What i would advice:
    - Set the database in Single-user mode
    - Set the database in Emergency Mode.

    Depending on what you want to do, choice one.
    Though if you have an aggresive connector with a bad setup, setting it in SingleUser might mean you will lose the ability to connect.

    Emergency Mode will mean the database is offline to applications and only accessable to sys-admins, though the impact is normally more server it is fairly easy to Ensure you're the soul user.

    with regards,
    Sebastian

    Tuesday, August 2, 2016 8:06 AM