Friday, March 9, 2012

List of Logged ON USERS

Hi All,
I use SQL Server 2000. Before I do some critical DB Updates I wanted to know
the LIST of Users logged on to the SAME DB, so that I can Inform them to
Logout from the DB before I start the Process.
How Do I know the List of Users that have logged on to the DB - The List
should not include my login ( or ) a comment beside my login.
Thanks
PrabhatOne way would be to make a copy of the sp_who2 procedure and modify it to do
what you want. It wouldn't be difficult. Call it sp_who3 for example
"Prabhat" wrote:
> Hi All,
> I use SQL Server 2000. Before I do some critical DB Updates I wanted to know
> the LIST of Users logged on to the SAME DB, so that I can Inform them to
> Logout from the DB before I start the Process.
> How Do I know the List of Users that have logged on to the DB - The List
> should not include my login ( or ) a comment beside my login.
> Thanks
> Prabhat
>
>|||Hi,
Apologies if this is a silly statement. You can use Enterprise Manager to
view a list of currently active connections. Go to Management | Current
Activity | Process Info
This will give you a list of current active sessions although it does
include things like the Checkpoint and Lazy Writer processes. As long as you
can filter these out you should be able to see which users are connected and
which application they are using.
Hope this answers your question. If you already knew this then I apologise
for stating the obvious :)
Cheers,
IM
"Prabhat" wrote:
> Hi All,
> I use SQL Server 2000. Before I do some critical DB Updates I wanted to know
> the LIST of Users logged on to the SAME DB, so that I can Inform them to
> Logout from the DB before I start the Process.
> How Do I know the List of Users that have logged on to the DB - The List
> should not include my login ( or ) a comment beside my login.
> Thanks
> Prabhat
>
>|||Prabhat
One of the many options is
select hostname from master..sysprocesses
where spid>50 and dbid=db_id('databasename')
"Prabhat" <not_a_mail@.hotmail.com> wrote in message
news:OtgrPnkdFHA.3376@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I use SQL Server 2000. Before I do some critical DB Updates I wanted to
know
> the LIST of Users logged on to the SAME DB, so that I can Inform them to
> Logout from the DB before I start the Process.
> How Do I know the List of Users that have logged on to the DB - The List
> should not include my login ( or ) a comment beside my login.
> Thanks
> Prabhat
>|||Using Sysprocesses is the way to go... but it may change with SQL 2005, so
make sure you insulate yourself so you can make changes easily.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Prabhat" <not_a_mail@.hotmail.com> wrote in message
news:OtgrPnkdFHA.3376@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I use SQL Server 2000. Before I do some critical DB Updates I wanted to
> know
> the LIST of Users logged on to the SAME DB, so that I can Inform them to
> Logout from the DB before I start the Process.
> How Do I know the List of Users that have logged on to the DB - The List
> should not include my login ( or ) a comment beside my login.
> Thanks
> Prabhat
>|||"Prabhat" <not_a_mail@.hotmail.com> wrote in message
news:OtgrPnkdFHA.3376@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I use SQL Server 2000. Before I do some critical DB Updates I wanted to
> know
> the LIST of Users logged on to the SAME DB, so that I can Inform them to
> Logout from the DB before I start the Process.
> How Do I know the List of Users that have logged on to the DB - The List
> should not include my login ( or ) a comment beside my login.
> Thanks
> Prabhat
Use the sysprocesses table on the master database.
If you want, you could also try the application that I have developed called
DBMonitor. This will inform you of the users connected to each database, if
the users are actually running any commands, and what commands they are
running.
You can find a copy at http://dbmonitor.tripod.com
--
David Rowland
DBMonitor version 1.2 out now! http://dbmonitor.tripod.com
Email Alerts, logging, performance stats, process information!
Only $49.95|||Thanks Uri and All for giving the Suggestions.
I think the the sysprocessess is the best option to go with and as Wayne
Snyder suggest I should be ready for 2005 also.
Thanks
Prabhat
> One of the many options is
> select hostname from master..sysprocesses
> where spid>50 and dbid=db_id('databasename')

No comments:

Post a Comment