Solved

SQL Profiler trace to capture all transactions/queries for all the DB's in the SQL 2005 instance

Posted on 2013-11-11
2
554 Views
Last Modified: 2013-11-18
Hello there,

We are in the process of identifying the DB's that are currently active OR in use. I was thinking if using SQL profiler to run a trace.
As I have 40 DB's in the instance, how should I go about selecting all these DB's so that I can check if indeed there are any transdaction happening.
In this we know which DB's are currently active.

Is my understanding correct? If so how should I go about setting up trace.

Please advise.

Thanks and Regards
0
Comment
Question by:goprasad
2 Comments
 

Author Comment

by:goprasad
ID: 39640810
OR can i use the following query, will this be source of truth:

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections, loginame as LoginName FROM sys.sysprocesses
WHERE dbid > 0GROUP BY dbid, loginame

Please advise.
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39641012
Querying sys.sysprocesses will only give you a point-in-time view (i.e. will only tell you if anybody is connected at that exact moment).

Personally I would run a trace on the "Audit Schema Object Access Event" class (under the "Security Audit Event" section) and a a filter on the DatabaseID column to only show anything with an ID > 4.

You'll need to run it for a period of time that would cover a reasonable window for when you would expect people to access any of the databases.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSAS Store Forecasting data in the cube 1 17
Negative isnull? 3 14
SQL create line numbers for data sampling 11 26
SQL Recursion schedule 13 13
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

792 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