Wednesday, November 16, 2011

The database is in single-user mode, and a user is currently connected to it

PROBLEM:
You get one of the following errors in Microsoft Sql Server Management Studio when trying to access database
  • Database is already open and can only have one user at a time.
  • Changes to the state or options of database cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.

SOLUTION:
You need to kill all database sessions and get the database out of single-user mode


use master
GO
-- the following query lists all database sessions
select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame
from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid
where d.name = 'db_name'
GO
-- kill session using SPID number
kill 52
GO
exec sp_dboption 'db_name', 'single user', 'FALSE'
GO


If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!


65 comments:

  1. Replies
    1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru Dot Net Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
      or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

      Delete
    2. IEEE Final Year Project centers make amazing deep learning final year projects ideas for final year students Final Year Projects for CSE to training and develop their deep learning experience and talents.

      IEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation.

      corporate training in chennai corporate training in chennai

      corporate training companies in india corporate training companies in india

      corporate training companies in chennai corporate training companies in chennai

      I have read your blog its very attractive and impressive. I like it your blog. Digital Marketing Company in Chennai Project Centers in Chennai

      Delete
  2. You saved my job just now!!

    ReplyDelete
  3. good fix... thank god... :-)

    ReplyDelete
  4. You saved me today

    ReplyDelete
  5. Thanks, its very useful :-)

    ReplyDelete
  6. Damn bro, you are awesome. worked like a charm

    ReplyDelete

  7. Parking software condominium
    email blast to tenants
    Guest parking
    Software for parking enforcement, parking violations and parking management”
    World-wide-web solutions in a group retain the most important data fiscal information and other very sensitive and exclusive information will be transported and located. Property or home Operators condo supervisors, Panel Associates, professional property or home and linked to overseeing was able car parking setting.
    You need dependable, progressive in addition to successful software program to handle your current businesses auto parking in addition to customer passes. You desire a built-in process that enables to be able to easily tracking check in addition to alter exactly where persons park your car in addition to have. Entrance functions achieve all this together with effective however convenient to use process agreed upon to guarantee the safety measures of your campus in addition to lots. A era your current campus lots auto parking structure sub-sections together with custom made place assignments, Car or truck Registration together with in decal allocation in addition to rebirth procedure, Auto parking Citations in addition to accounts receivable functions.

    ReplyDelete
  8. Thanks For sharing nice article about database development services.
    Database Development Services in India

    ReplyDelete
  9. Thanks For sharing nice article about database development services.
    Database Development Services in India

    ReplyDelete

  10. I enjoying your post. You definitely have some great insight and great stories.


    Financial Advice Horsham


    find a financial advisor

    ReplyDelete
  11. This post still helped me!

    ReplyDelete
  12. but it says script cannot be executed.. because the connection is not there.
    what should i do? help needed asap

    ReplyDelete
  13. Really you have done great job,There are may person searching about that now they will find enough resources by your post
    Best Devops Training in pune
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  14. Beverly D. VillafaneJanuary 9, 2019 at 4:19 AM

    This problem is related to database corruption. Use the sp_who stored procedure to kill the processes that are active in the database. If it doesn’t solve your problem then try T-SQL commands in SSMS. Use below commands:

    USE master;
    GO
    ALTER DATABASE youdbname
    SET SINGLE_USER
    WITH ROLLBACK IMMEDIATE;
    GO

    In this situation, if T-SQL command doesn’t’ not work properly it means there is high corruption in SQL database file. So, to restore the corrupted database file I have go through below resources and analyze that Stellar repair for MS SQL is the best solution to fix database corruption issues.

    Visit here: https://www.geckoandfly.com/27550/repair-recover-corrupt-sql-database/

    ReplyDelete

  15. It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.


    It seems you are so busy in last month. The detail you shared about your work and it is really impressive that's why i am waiting for your post because i get the new ideas over here and you really write so well.

    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete
  16. Resources like the one you mentioned here will be very useful to me ! I will post a link to this page on my blog. I am sure my visitors will find that very useful
    python Online training in chennai
    python training institute in marathahalli
    python training institute in btm
    Python training course in Chennai

    ReplyDelete
  17. I have gone through your blog, it was very much useful for me and because of your blog, and also I gained many unknown information, the way you have clearly explained is really fantastic. Kindly post more like this, Thank You.
    apple service center chennai
    apple service center in chennai
    apple mobile service centre in chennai
    apple service center near me

    ReplyDelete
  18. Thanks for sharing excellent information.If you Are looking Best smart autocad classes in india,
    provide best service for us.
    autocad in bhopal
    3ds max classes in bhopal
    CPCT Coaching in Bhopal
    java coaching in bhopal
    Autocad classes in bhopal
    Catia coaching in bhopal

    ReplyDelete
  19. Its help me to improve my knowledge and skills also.im really satisfied in this microsoft azure session.microsoft azure training in bangalore

    ReplyDelete
  20. Linking is very useful thing.you have really helped lots of people who visit blog and provide them use full information.Automation Anywhere Training in Bangalore

    ReplyDelete
  21. Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well as giving.uipath training in bangalore

    ReplyDelete
  22. Really it was an awesome article,very interesting to read.You have provided an nice article,Thanks for sharing.blue prism training in bangalore

    ReplyDelete
  23. This is really an awesome post, thanks for it. Keep adding more information to this.openspan training in bangalore

    ReplyDelete
  24. Good to know about the email list business. I was looking for such a service for a long time o grow my local business but the rates that other companies were offering were not satisfactory. Thanks for sharing the recommendations in this post.hadoop training institutes in bangalore

    ReplyDelete
  25. Wow its a very good post. The information provided by you is really very good and helpful for me. Keep sharing good information.

    Become an Expert In DBA Training in Bangalore! The most trusted and trending Programming Language. Learn from experienced Trainers and get the knowledge to crack a coding interview, @Bangalore Training Academy Located in BTM Layout.

    ReplyDelete
  26. Very interesting, good job and thanks for sharing such a good blog.

    Best SAP S4 HANA Training in Bangalore for SAP, Real Time Experts Training Center provides the sap training project with trainers having more than 5 Years of sap training experience; We also provide 100% placement support.

    ReplyDelete
  27. This is an brilliant put up.Really very informative and creative contents.
    These idea is a good manner to decorate the knowledge.

    click here formore info.

    ReplyDelete
  28. Very correct statistics furnished, Thanks a lot for sharing such beneficial data.
    katmovies
    ............................................................

    ReplyDelete
  29. This comment has been removed by the author.

    ReplyDelete
  30. Snapdeal Winner List here came up with an Offer where you can win Snapdeal prize list 2020 by just playing a game & win prizes.
    Snapdeal winner name2020 also check the Snapdeal lucky draw2020

    ReplyDelete
  31. Thanks for sharing the great usefull blog
    Shopclues lucky draw 2020| Shopclues winner 2020|Get to Know Shopclues Lucky Draw Winner 2020. Call Shopclues Helpline Phone Number+91-9835565523 for Shopclues Online Shopping Lucky Draw.
    Shopclues online lucky draw winner
    Shopclues winner 2020
    shopclues car lucky draw

    ReplyDelete
  32. Thanks for the informative article About Python.This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.

    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete
  33. All the points you described so beautiful. Every time i read your i blog and i am so surprised that how you can write so well.
    devops training in chennai | devops training in anna nagar | devops training in omr | devops training in porur | devops training in tambaram | devops training in velachery

    ReplyDelete

  34. That is nice article from you , this is informative stuff . Hope more articles from you . I also want to share some information about devops training in pune

    ReplyDelete
  35. Good Post! , it was so good to read and useful to improve my knowledge as an updated one, keep blogging.After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.

    aws training in pune

    ReplyDelete
  36. Get Packers and Movers Jaipur List of Top Reliable, 100% Affordable, Verified and Secured Service Provider. Get Free ###Packers and Movers Jaipur Price Quotation instantly and Save Cost and Time. Packers and Movers Jaipur ✔✔✔Reviews and Compare Charges for household Shifting, Home/Office Relocation, ***Car Transportation, Pet Relocation, Bike SHifting @ Packers And Movers Jaipur

    ReplyDelete
  37. Excellent effort to make this blog more wonderful and attractive. ExcelR Data Science Course In Pune

    ReplyDelete
  38. Digibrom is the Best Digital Marketing
    Training & Services In Bhopal
    Digibrom is the Best Digital Marketing Training & Services in Bhopal, providing complete digital growth for your business. We are one of the leading Digital Marketing company in Bhopal, and we are experts in digital marketing & web design. The market penetration along with the use of digital technology is our power. We serve businesses according to the need and requirements of the customers and deliver quality work in time because Digibrom is the best digital marketing training institute in Bhopal and service provider. We create likable content that increases the time spent by the customer on the internet.Digital Marketing is one of the greatest opportunities for a great career. Including lots of opportunities within the field and attractive salaries, it’s the best time to connect a digital marketing Training. These days Digibrom is the Best Digital Marketing Training In Bhopal. it has become a demand for professions to have a solid online presence and for that, people need to get help from digital marketing companies to improve their online appearance. Digibrom is the best digital marketing Training & Services company in Bhopal.
    Digital marketing Training in bhopal

    Digital marketing course bhopal

    ReplyDelete
  39. Digibrom is the Best Digital Marketing
    Training & Services In Bhopal
    Digibrom is the Best Digital Marketing Training & Services in Bhopal, providing complete digital growth for your business. We are one of the leading Digital Marketing company in Bhopal, and we are experts in digital marketing & web design. The market penetration along with the use of digital technology is our power. We serve businesses according to the need and requirements of the customers and deliver quality work in time because Digibrom is the best digital marketing training institute and service provider. We create likable content that increases the time spent by the customer on the internet.
    Digital marketing Training in bhopal
    Digital marketing company in bhopal

    ReplyDelete
  40. Master Wang earned fame and recognition from the streets where he was offering his soulmate drawing services. Check now Master Wang drawings reviews for more information. Its service’s popularity and remarkable effectiveness led to high demand by people from all parts of the world. His psychic and astrology abilities are exceptional, and he has successfully guided millions of people towards their soulmates. He has now created his website to ensure everyone in the world can benefit from his soulmate drawings. Master Wang’s new soulmate drawing services represent the best and most unique solution to finding your precious soulmate. He leverages his years of experience in astrology and being a psychic to create compelling visuals that often come true. With a few simple questions, he will see and draw your soulmate and help you on your personal love journey.

    ReplyDelete
  41. The 1tac TC1200 utilizes Cree XML2 LED innovation and has a yield of 1200 Lumens. The life expectancy of the electric lamp is around 100,000 hours of light. The TC1200 additionally has a carefully directed net to guarantee that the splendor is kept up for the duration of the existence of the morning. You may have used the flashlight before, but 1tac TC1200 tactical flashlight is different from others. Check now 1Tac Flashlight Reviews to clear your doubt. These are flashlights intended to pull twofold obligation. In addition to the fact that they function as electric lamps to help you find uncertainty, they also fill in as weapons.

    ReplyDelete
  42. Database, Devops and software development great article very informative. Thanks for sharing, keep updating us with such articles.

    Data Science Training in Pune

    ReplyDelete
  43. I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end.
    Python Classes in Pune

    ReplyDelete
  44. Amazing Article! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Data science course in pune

    ReplyDelete