SQL Server Profiler - 2012
SQL Server Profiler - 2012
ADMINISTRATION
SQL SERVER PROFILER
INTRODUCTION
Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for
monitoring T-SQL Statements of Database Engine. We can save and reuse
the state at a later point of time.
We can do the following using SQL Server Profiler
Create a trace
Watch the trace results as the trace runs
Store the trace results in a table
Start, stop, pause, and modify the trace results as necessary
Replay the trace results
Use SQL Server Profiler to monitor only the events in which you are
interested
MENU PATH:
Start | All Programs | Microsoft SQL Server 2005 | Performance Tools | SQL
Server Profiler.
The following screen will come:
Section 4: You can stop your trace on a particular time. Check the "Enable trace stop
time" checkbox and give the time at which you want to stop track, SQL Server will
automatically stop trace on that time.
Now Move To "Event Section" Tab.
Now we need to know some definition with respect to SQL Server Profiler.
What is an Event?
An Event is an action or operation that is performed in your SQL Server 2005 Database
Engine.
Some examples of Events are:
Transact-SQL SELECT, INSERT, UPDATE, and DELETE statements.
User login and logout
Execution of Stored procedures
Operation with cursor
SQL Server profiler is able to trace all of these events and all these events are categories on a
particular Event class.
What is an Event Class?
Event class is a type of event that can be traced.
Some examples are:
SQL: BatchCompleted
SQL: Batch Starting
Audit Login
Audit Logout
Lock: Acquired
Lock: Released
Now you can select events from this screen:
In section 1, we can select the proper check box based upon our requirement, section 2 will
display the details of Selected events and Events class. If you check in the check box of
section 3, you will get all the list of Events and Columns in Section 1.
Section 4 is something like customization. Just click on the "Column Filter Button". In
this section, you can specify some condition (like or Not like).
By clicking on "Organize Column" button, you can change the sequence of order of selected
events.
Now Click on the "Run" Button, then Trace window will come:
Using these windows, you will get the detailed time duration of a query and all other
events information that you have selected.
You can save this result and use it in future. Or you can extract a particular query from the
trace, just right click and click on "Extract Event Data". And save this as a SQL Script.