首页 > 数据库

An Introduction to Dynamic Management Views and Functions in SQL Server 2005

时间:2009-04-23 12:54:30  作者:武树伟  我要投稿
Linux初探欢迎您的投稿,投放方法请点击这里查看,我们会定期赠送精美小礼品给优秀的投稿作者。海纳百川 取则行远!LinuxGoo欢迎您的到来。
An Introduction to Dynamic Management Views and Functions in SQL Server 2005By : Brad McGeheeFeb 08, 2007 One my most favorite features of SQL Server......

An Introduction to Dynamic Management Views and Functions in SQL Server 2005

By : Brad McGehee
Feb 08, 2007

One my most favorite features of SQL Server 2005 is the introduction of Dynamic Management Views (DMVs) and Dynamic Management Functions (DMFs). They allow the DBA to take a peek into the internal workings of SQL Server at both the server and database levels. Using DMVs and DMFs, the DBA can better monitor the health of SQL Server, better tune SQL Server, and troubleshoot many kinds of problems. In many cases, they replace the need to use system tables and other obscure methods to find out what is happening inside SQL Server. And in many other cases, they provide new insights into SQL Server internals that have never been available before to DBAs.

While DMVs and DMFs provide a wealth of information, the information they provide is often esoteric or difficult to understand. Because of this, there is a fairly steep learning curve when using them. In addition, you must use Transact-SQL to SELECT the results you want, so you must have a basic understanding of how to write SELECT statements in order to take full advantage of them.

The purpose of this article is to introduce you to them at a high level; in later articles, I will drill down into how specific DMVs and DMFs can be used to help you performance tune your servers and databases.

The Basics

There are two different kinds of DMVs and DMFs:

  • Server-scoped: These look at the state of an entire SQL Server instance.
  • Database-scoped: These look at the state of a specific database.

All DMVs and DMFs exist in the master database and belong to the sys schema. They also follow the naming convention of dm_*, such as:

sys.dm_db_index_usage_stats

DMVs can be referred to in Transact-SQL using the DMVs two-part, three-part, or four-part name. DMFs have to be referred to using either their two-part or three-part names in code. Neither DMVs nor DMFs can be referred to with their one-part name. The two-part name example above is the most common way to refer to DMVs and DMFs.

To access a DMV or DMF, the user must have SELECT permission on the specific DMV or DMF they want to access and must have either VIEW SERVER STATE or VIEW DATABASE STATE permission, depending on if the DMV or DMF is server- or database-based. By default, members of the sysadmin group have these permissions.

如果您需转载 An Introduction to Dynamic Management Views and Functions in SQL Server 2005,请注明来自LinuxGoo.com,其版权归原作者所有。请广大网友留言时遵纪守法,使用文明用语。如果您在应用中有什么问题,请在下面留言,我们会尽快解答。
来顶一下
近回首页
返回首页
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表
相关文章
栏目热门