In 2005, I can open the Activity Monitor and in Process Info, I can see the
Process ID, User and Database.
In 2008, in Activity Monitor and in Processes, I can see SessionID (which I
assume is the Process ID from 2005) andLogin (which I assume is User from
2005) and Database which is showing only tempdb and blanks for all the
databases?????
I am trying to find any users that are connected to a database I am trying
to restore and cannot get exclusive access. I have all my queries closed
and anything that was using the database has been closed.
In the 2005 AM I can see my with one session open and showing the database
name. But in 2008, I can see the same session ID with no Database showing -
which is pretty much worthless.
Why is that???
Also, what would the command line be to get the same information?
Thanks,
Tom
tshad - 26 Jun 2009 22:41 GMT
Also, in the 2008 AM, the SessionID 66 shows the command as blank, but when
I do a right click and select details, I get as the last command:
(@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000),@_msparam_2
nvarchar(4000),@_msparam_3 nvarchar(4000),@_msparam_4
nvarchar(4000),@_msparam_5 nvarchar(4000))SELECT
p.name AS [Name]
FROM
sys.all_objects AS sp
INNER JOIN sys.all_parameters AS param ON param.object_id=sp.object_id
INNER JOIN sys.extended_properties AS p ON p.major_id=param.object_id AND
p.minor_id=param.parameter_id AND p.class=2
WHERE
(param.name=@_msparam_0)and((sp.type = @_msparam_1 OR sp.type = @_msparam_2
OR sp.type=@_msparam_3)and(sp.name=@_msparam_4 and
SCHEMA_NAME(sp.schema_id)=@_msparam_5))
ORDER BY
[Name] ASC
But in 2005 AM, the ProcessID shows the command as blank but right clicking
and selecting details shows the Last Command as blank.
Thanks,
Tom
> In 2005, I can open the Activity Monitor and in Process Info, I can see
> the Process ID, User and Database.
[quoted text clipped - 19 lines]
>
> Tom
Andrew J. Kelly - 27 Jun 2009 22:19 GMT
sp_who2 should show you want you want to know. But try placing the db in
single user mode with the ROLLBACK IMMEDIATE option to kill any open
connections.

Signature
Andrew J. Kelly SQL MVP
Solid Quality Mentors
> In 2005, I can open the Activity Monitor and in Process Info, I can see
> the Process ID, User and Database.
[quoted text clipped - 19 lines]
>
> Tom
tshad - 29 Jun 2009 04:02 GMT
> sp_who2 should show you want you want to know. But try placing the db in
> single user mode with the ROLLBACK IMMEDIATE option to kill any open
> connections.
That's fine and it does.
But why doesn't the Activity Monitor show me the databases I am connected to
as it used to.
It really is pretty much useless otherwise.
If I have 40 processes connected to the database and I know that I need to
look at one of the processes connected to DBx, there is no way in AM to do
this.
Thanks,
Tom
>> In 2005, I can open the Activity Monitor and in Process Info, I can see
>> the Process ID, User and Database.
[quoted text clipped - 19 lines]
>>
>> Tom
Andrew J. Kelly - 29 Jun 2009 14:46 GMT
I honestly couldn't tell you as I think I have only used AM 2 or 3 times and
that was just for kicks. I usually query the DMV's directly or use sp_who2.

Signature
Andrew J. Kelly SQL MVP
Solid Quality Mentors
>> sp_who2 should show you want you want to know. But try placing the db in
>> single user mode with the ROLLBACK IMMEDIATE option to kill any open
[quoted text clipped - 38 lines]
>>>
>>> Tom
Linchi Shea - 29 Jun 2009 15:07 GMT
It looks like Activity Monitor only shows the database name for a spid if the
spid is activvely doing something, not what database it is currently
connected.
Linchi
> > sp_who2 should show you want you want to know. But try placing the db in
> > single user mode with the ROLLBACK IMMEDIATE option to kill any open
[quoted text clipped - 38 lines]
> >>
> >> Tom
tshad - 02 Jul 2009 22:23 GMT
> It looks like Activity Monitor only shows the database name for a spid if
> the
> spid is activvely doing something, not what database it is currently
> connected.
Yup, as I said pretty useless.
2005 showed the database for all processes. Not sure why they took it out.
Thanks,
Tom
> Linchi
>
[quoted text clipped - 48 lines]
>> >>
>> >> Tom
Aaron Bertrand [SQL Server MVP] - 02 Jul 2009 23:59 GMT
I don't know why either, but I know that this is one of the columns missing
from the port from sysprocesses to sys.dm_exec_sessions and
sys.dm_exec_requests. The intention, I gather, to split this into two views
was to avoid having to carry around a bunch of useless columns for tasks
that weren't currently doing anything. But they only put database context
information into the requests view, which is the one that is empty when a
session is asleep. Vote for this item, it was closed as fixed but clearly
there is still work to do:
http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=25750
2
On 7/2/09 5:23 PM, in article #QiMNt1#JHA.4432@TK2MSFTNGP05.phx.gbl, "tshad"
<toms@pdsa.com> wrote:
>> It looks like Activity Monitor only shows the database name for a spid if
>> the
[quoted text clipped - 61 lines]
>>>>>
>>>>> Tom