Profiler trace of database


Profiler trace of database : If you are having a problem with a machine that is working slow and you suspect that a database is causing the
trouble you can run a profiler trace on the databases to find out witch one that might cause problems.

Profiler.

1. Start a new trace and save the file to table at your choice
2. Under Events, delete security audit, session
3. Under Data Columns, columns add databaseid
4. Start trace

Query Analyser: QA

1. To get information as the trace is running you can run the following code;

select db_name(databaseid)as DatabaseName,sum(duration)as ‘Duration(MS)’ from tablename
group by databaseid
order by sum(duration) desc

go
select db_name(databaseid)as DatabaseName,sum(reads)as sumreads from tablename
group by databaseid
order by sum(reads) desc

go
select db_name(databaseid)as DatabaseName,sum(cpu)as ‘sum CPU(CPUMillisecnds)’ from tablename
group by databaseid
order by sum(cpu) desc

go
select db_name(databaseid)as DatabaseName,sum(writes)as writes from tablename
group by databaseid
order by sum(writes) desc

2. You can choose to have the result as either text or grid. The result will show the amount of reads, writes, cpu and duration usage that is at hand.

3. Use the information to further analyze the database.

Khan sql dba – mcitp

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s