Solved

SQL 2005 active database

Posted on 2014-12-18
2
82 Views
Last Modified: 2014-12-22
I have two databases configured with similar names. An application on my network communicates with one of the databases. I want to identify which one without looking at the client side. Is there anything I can view in SQL 2005 that will tell me which one is the active one. thanks
0
Comment
Question by:Sid_F
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
ste5an earned 500 total points
ID: 40506758
No.

But you can use  
SELECT  C.session_id ,
        C.connect_time ,
        C.net_transport ,
        C.protocol_type ,
        C.client_net_address ,
        C.client_tcp_port ,
        C.local_net_address ,
        C.local_tcp_port ,
        C.connection_id ,
        C.parent_connection_id ,
        S.spid ,
        S.blocked ,
        S.status ,
        S.sid ,
        S.hostname ,
        S.program_name ,
        S.hostprocess ,
        S.cmd ,
        S.nt_domain ,
        S.nt_username ,
        S.net_address ,
        S.net_library ,
        S.loginame 
FROM    sys.dm_exec_connections C
        INNER JOIN sys.sysprocesses S ON C.session_id = S.spid;

Open in new window

to see who's connected to your database(s).
0
 
LVL 50

Expert Comment

by:Vitor Montalvão
ID: 40506786
I have two databases configured with similar names.
In the same instance? That's impossible.
Please clarify where those two databases are.

I want to identify which one without looking at the client side.
Assuming that the databases with the same name are in different instances, you need to connect to each instance and run the command sp_who2. This stored procedure returns all connections to the respective instance and has information about the user, application and the client computer that is connecting.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question