Solved

SQL 2005 active database

Posted on 2014-12-18
2
74 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
2 Comments
 
LVL 33

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 48

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Query - which index being used? 2 61
Pivot Query Problem 9 47
SQL query to summarize items per month 5 71
ISDATE() not working properly on my table? Any suggestions. 7 38
This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 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