Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2005
    Posts
    36

    Unanswered: Need help with restoring database

    hey...
    when i try to restore my database... they gave an error. the database is still in use.. is there a way to kill all the connections to that database ?

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    ALTER DATABASE whatever SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    Feb 2005
    Posts
    36
    hey.. i already have the stored procedure to restore the database,....
    i am using the codes below


    CREATE Procedure spRestoreDatabase
    @Path VARCHAR(1000)
    AS
    Restore Database KAC From Disk = @Path
    GO

    the thing is.. when i am running the program.. there are some connections to the database.. that i don't know where its coming from.. so i want to kill off everything..

    can you explain a little on that code you passed above.. thx

  4. #4
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    CREATE Procedure spRestoreDatabase
    @Path VARCHAR(1000)
    AS
    --Kicks all the users out of the database and set it to single user.
    ALTER DATABASE KAC SET SINGLE_USER WITH ROLLBACK IMMEDIATE
    --Restores the database.
    Restore Database KAC From Disk = @Path
    GO
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •