- 论坛徽章:
- 6
|
不知道你看sp_monitorconfig的源码没有?最好自己看一下。
以前echoaix就在博客中介绍config_admin()这个系统函数的用法。
看sp_monitorconfig的源码,稀里糊涂的。通过config_admin计算的就不知道如何实现的了。- /*
- ** Get the run value for the config variable
- */
- select @config_runval = value
- from master.dbo.syscurconfigs
- where config = @confignum
- /*
- ** Retrieve info for the 4 counters. Pass flag 2 as the third
- ** parameter of config_admin() to get the active value
- */
- select @num_active = config_admin(22, @confignum, 2, 0, @counter1, NULL)
- /*
- ** Pass flag 3 as the third parameter of config_admin() to get
- ** the max value.
- */
- select @max_active = config_admin(22, @confignum, 3, 0, @counter2, NULL)
复制代码 个人总结出,config_admin()有6个参数。发现第一个参数有16或者22的情况。都是统计配置参数值的。- 下面是我的研究总结:
- 1> select name,config_admin(16,config,1000,0,null,null) from sysconfigures where name lik
- e '%number of open partitions%'
- 2> go
- name
- -----------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------
- -----------
- number of open partitions
- 999
- config_admin应该是返回配置参数相关信息的函数。如:估计指定参数值的所耗内存,根据内存值估计可配置参数值大小。
- 还有其它未知??
- 如上面的例子:config_admin(16,config,1000,0,null,null)。第一个参数:16的意思是估计参数值所需配置内存大小,
- 或者根据内存显示可配置的参数大小。第二个参数为:参数数值,对应sysconfigures.config或syscurconfigs.config。
- 第三个和第四个参数是相关的。如果第四个配置为:1,则第三个参数数值表示内存值(以K为单位)。如果第四个参数配置为:0
- ,则第三个参数值表示配置参数值。第五、六个参数已知都配置为null。
复制代码 |
|