shut down the database

  • there is any command in sql to shut down the database.shutdown means take offline.only db_owner has that rights.

  • ALTER DATABASE [MyTests1] SET OFFLINE

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • You can also set it to READ_ONLY if you want access to it, but don't want anyone to be able to change the data.

    (Not what you asked, but just as FYI)

  • mohinidba (10/22/2008)


    there is any command in sql to shut down the database.shutdown means take offline.only db_owner has that rights.

    Why? What are you trying to do?

    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
  • Good question Gail..:cool:

    mohini why would you need to take the DB offline :hehe:. If you only want to restrict access then go ahead and set it in Single User mode

    alter database [db_name] set SINGLE_USER

    Hope this helps..

    Thanks!!

    The_SQL_DBA
    MCTS

    "Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."

  • i got one pwp in this i need to shutdown the db .my task is migraton of db from one host to another host .

  • If you're trying to move the DB, detach it. If you do it through management studio, you can specify to drop all connections first. Then you can move the files safely and reattach them.

    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

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

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