30.06.2013 Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

Performance Tuning with SQL Server Dynamic Management Views

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 1: Using <strong>Dynamic</strong> <strong>Management</strong> Objects<br />

In releases prior to <strong>SQL</strong> <strong>Server</strong> 2005, <strong>SQL</strong> <strong>Server</strong> exposed metadata in a range of<br />

physical system tables, stored or referenced in the master database (e.g. master.dbo.<br />

sysobjects or dbo.sysprocesses). Microsoft warned <strong>SQL</strong> DBAs and developers not<br />

to code against the system objects, as they could not guarantee that they would not be<br />

changed, or that they would even continue to be supported in future releases. However,<br />

most DBAs did just that, and the sysprocesses system table, in particular, became the<br />

"go-to" source of information when troubleshooting performance concerns in <strong>SQL</strong><br />

<strong>Server</strong>. This single table gave the DBA access to the spid (unique identifier for the user<br />

session), cumulative CPU usage, memory, and I/O consumption, client connectivity<br />

information (host name, host program name, login information, and process id) and<br />

a myriad of other important columns that identified, at a quick glance, what was<br />

transpiring on the <strong>SQL</strong> instance at any given time. Many of us rolled our own<br />

management solutions and queries, based on sysprocesses, allowing us to dig into the<br />

guts of <strong>SQL</strong> <strong>Server</strong>.<br />

Microsoft realized the importance of these scripts, and knew that many DBAs relied on<br />

them but, at the same time, wanted to introduce a layer of abstraction between the user<br />

and their metadata. So, starting in <strong>SQL</strong> <strong>Server</strong> 2005, they moved the system tables from<br />

the master database into the new resource database that is inaccessible to the enduser,<br />

and even the DBA (there are techniques to access the resource database, if it is<br />

really necessary, but we won't cover them here).<br />

In their place, in the master database, Microsoft created a set of compatibility views,<br />

based on the data in these, now hidden, system tables. These compatibility views are<br />

structured identically to the original system tables they were replacing (column names,<br />

data types, and column order remain constant), but they are now owned by the sys<br />

schema. They were provided purely for backwards compatibility purposes; they do not<br />

reflect any new features and functionality added in <strong>SQL</strong> <strong>Server</strong> 2005 and later. However,<br />

<strong>with</strong> a simple schema change in any applicable code, they allowed DBAs to keep using<br />

their existing set of troubleshooting scripts and tools.<br />

At the same time, <strong>with</strong> <strong>SQL</strong> <strong>Server</strong> 2005, Microsoft introduced a new set of system<br />

catalog views, as well as the DMOs, both of which also live in the master database, but<br />

18

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!