Restarting One Database Not Entire Server

  • Is there anyway to restart one database in SQL Server instead of restarting the entire server? I have a task in perpetual rollback on one of my databases. I'd like to restart it without turning off / on the other DBs

  • What do you mean by – "Restart one database"?

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Set the database to offline then set it to online, but will wait till all connections have done what they need to do, or if you specify with rollback waits until they all rollback, so if the connection is already rolling back it wont do you any good.

    The only option is to restart SQL and wait for recovery to complete on the database in question.

  • You are able to take a database offline and bring it online with following code. Its not necessarily the restart of a specific database, which I am not aware of, this will allow to kill all the connections to the database at least.

    ALTER DATABASE dbname SET OFFLINE WITH ROLLBACK IMMEDIATE

    GO

    ALTER DATABASE dbname SET ONLINE

    GO

    Or, right click database->Task->Take Offline

  • Edit: nm, can't read apparently...

    What do you get when you try to kill the spid?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • how long has it been in rollback?

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply