- 論壇徽章:
- 6
|
不知道你看sp_monitorconfig的源碼沒有?最好自己看一下。
以前echoaix就在博客中介紹config_admin()這個系統(tǒng)函數(shù)的用法。
看sp_monitorconfig的源碼,稀里糊涂的。通過config_admin計算的就不知道如何實現(xiàn)的了。- /*
- ** 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)
復(fù)制代碼 個人總結(jié)出,config_admin()有6個參數(shù)。發(fā)現(xiàn)第一個參數(shù)有16或者22的情況。都是統(tǒng)計配置參數(shù)值的。- 下面是我的研究總結(jié):
- 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應(yīng)該是返回配置參數(shù)相關(guān)信息的函數(shù)。如:估計指定參數(shù)值的所耗內(nèi)存,根據(jù)內(nèi)存值估計可配置參數(shù)值大小。
- 還有其它未知??
- 如上面的例子:config_admin(16,config,1000,0,null,null)。第一個參數(shù):16的意思是估計參數(shù)值所需配置內(nèi)存大小,
- 或者根據(jù)內(nèi)存顯示可配置的參數(shù)大小。第二個參數(shù)為:參數(shù)數(shù)值,對應(yīng)sysconfigures.config或syscurconfigs.config。
- 第三個和第四個參數(shù)是相關(guān)的。如果第四個配置為:1,則第三個參數(shù)數(shù)值表示內(nèi)存值(以K為單位)。如果第四個參數(shù)配置為:0
- ,則第三個參數(shù)值表示配置參數(shù)值。第五、六個參數(shù)已知都配置為null。
復(fù)制代碼 |
|