Know database current users

  • How can I know if other users are using a database? Sometimes I get Error 5070 when I want to take offline a database. And then how can I deny that user from accessing the database so that I can perform take offline?

    Thanks!


    AUXilliary COMmunication 1

  • Use Enterprise Manager, go to Management, Current Activity, Process Info.  This will provide a list of all the process id's currently active in the system and the users and databases associated with id.  You can also check to see what the process is running.

     

  • sp_who2 from a query window will get this as well (and it's quicker).

  • I get it now! I can kill the process so that I can take offline the database.

    Thanks!


    AUXilliary COMmunication 1

  • Also, if using Enterprise Manager, left-click on Management and refresh the settings.  This is not automatically done when you enter the Process Info area and can give you a false reading of users.

     

     

  • Do   sp_who active

    and kill any users that are active

    Just run sp_who to see sleeping process and kill them to take the db offline.

    There is a stored proc in the scripts area to kill users. Use it at u'r own risk.

    Cheers,

    Babu.

  • Ok... Many thanks to all of you! I will just play w/ it around!

    Thanks again!


    AUXilliary COMmunication 1

  • alter database myowndb set offline with ROLLBACK IMMEDIATE  will do the job

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • I have a database experiencing the "error 5070" but looking under the processes there are no users currently logged into it. Has anyone experienced this?

Viewing 9 posts - 1 through 8 (of 8 total)

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