sp_monitorconfig "<configname>"[, "<result_tbl_name>"][, "full"]
<configname>
或者是 all,或者是要查询其监控信息的配置参数名的一部分。在“用法”部分中列出了有效的配置参数。指定 all 将显示服务器中所有索引、对象、数据库和辅助扫描描述符的描述符帮助信息。
“<result_tbl_name>”
(可选)为保存存储过程结果而创建的表的名称。如果为 <result_tabl_name> 传递了尚不存在的表名,sp_monitorconfig 将创建一个表来保存结果集。
"full"
为您指定的 configname 返回一组值。其值包括:
显示已打开的所有项:
sp_monitorconfig "open"
Configuration option is not unique.
option_name config_value run_value
----------------------------- ---------- ----------
number of open databases 12 12
number of open objects 500 500
curread change w/ open cursors 1 1
open index hash spinlock ratio 100 100
number of open indexes 500 500
open index spinlock ratio 100 100
open object spinlock ratio 100 100
number of open partitions 500 500
显示所有配置的状态:
sp_monitorconfig "all"
</h2>
Usage information at date and time: May 6 2010 4:32PM.
Name Num_free Num_active Pct_act Max_Used Reuse_cnt Instance_Name
-------------------- --------- --------- ------- ------- --------- -------------
additional network memory 1358436 809440 37.34 825056 0 NULL
audit queue size 100 0 0.00 0 0 NULL
disk i/o structures 256 0 0.00 29 0 NULL
heap memory per user 4096 0 0.00 0 0 NULL
. . .
size of process object he 3000 0 0.00 0 0 NULL
size of shared class heap 6144 0 0.00 0 0 NULL
size of unilib cache 306216 816 0.27 816 0 NULL
txn to pss ratio 400 0 0.00 0 0 NULL
显示 61 个活动对象元数据描述符,其中 439 个是可用的。自 SAP ASE 服务器最后一次启动后在高峰期使用的最大值是 61:
sp_monitorconfig "open objects"
Usage information at date and time: Apr 22 2002 2:49PM.
Name Num_free Num_active Pct_act Max_Used Reuse_cnt Instance_Name
-------------------- --------- --------- ------- ------- --------- -------------
number of open objects 439 61 12.20 61 0 NULL
例如,您然后可以将该大小重新设置为 550,以容纳使用的最大元数据描述符的数目 439,外加 10% 的额外空间:
sp_configure "number of open objects", 330
显示索引元数据描述符的最大数目,该数目为 44:
sp_monitorconfig "open indexes"
Usage information at date and time: Apr 22 2002 2:49PM.
Name Num_free Num_active Pct_act Max_Used Reuse_cnt Instance_Name
-------------------- --------- --------- ------- ------- --------- -------------
number of open indexes 556 44 7.33 44 0 NULL
可以将该大小重新设置为 100,即最小可接受值:
sp_configure "number of open indexes", 100
将活动扫描描述符的数目显示为 30,尽管 SAP ASE 服务器被配置为使用 200 个这样的描述符。使用 number of aux scan descriptors 配置参数将该值重新设置为至少 32。较为保险的设置是 36,可以容纳 32 个扫描描述符,外加 10% 的额外空间:
sp_monitorconfig "aux scan descriptors"
Usage information at date and time: Apr 22 2002 2:49PM.
Name Num_free Num_active Pct_act Max_Used Reuse_cnt Instance_Name
-------------------- --------- --------- ------- ------- --------- -------------
number of aux scan descri 170 30 15.00 32 0 NULL
SAP ASE 服务器被配置用于 5 个打开的数据库,所有这些数据库都已用于当前会话:
sp_monitorconfig "number of open databases"
Name Num_free Num_active Pct_act Max_Used Reuse_cnt Instance_Name
-------------------- --------- --------- ------- ------- --------- -------------
number of open databses 0 5 100.00 5 Yes NULL
但是,如 Reuse_cnt 列所示,需要打开其它数据库。如果所有 5 个数据库都在使用中,将会导致错误,除非可以重新使用未在使用中的数据库描述符。为防止错误发生,应将 number of open databases 重新设置为更高的值。
只有 10.2% 的事务描述符当前正在使用中。但是,自 SAP ASE 服务器最后一次启动后在高峰期使用的事务描述符的最大数目是 523:
sp_monitorconfig "txn to pss ratio"
Usage information at date and time: Apr 22 2002 2:49PM.
Name Num_free Num_active Pct_act Max_Used Reuse_cnt Instance_Name
-------------------- --------- --------- ------- ------- --------- -------------
txn to pss ratio 784 80 10.20 523 0 NULL
使用可选参数 <result_tbl_name> 可以创建用户表,并将 sp_monitorconfig 结果保存到此表中:
create table sample_table
(Name varchar(35),Config_val int, System_val int, Total_val int,
Num_free int, Num_active int, Pct_act char(6), Max_used int,
Num_Reuse int, Date varchar(30))
create table sample_table
(Name varchar(35),
Config_val int,
System_val int,
Total_val int,
Num_free int,
Num_active int,
Pct_act char(6),
Max_Used int,
Reuse_cnt int,
Date varchar(30),
Instance_Name varchar(35))
创建的表名成为 sp_monitorconfig 的第二个参数。在 sample_table 中捕获 number of locks 和 number of alarms 的值:
sp_monitorconfig "locks", sample_table
sp_monitorconfig "number of alarms", sample_table
显示在 sample_table 中捕获的值:
select * from sample_table
Name Config_val System_val Total_val Num_free Num_active
Pct_act Max_used Reuse_cnt Date Instance_Name
------------------- ----------- ---------- --------- --------- ----------
------- -------- --------- ------------------- ------------------------
number of locks 5000 684 5000 4915 85
1.70 117 0 Aug 23 2006 6:53AM
number of alarms 40 0 40 28 12
30.00 13 0 Aug 23 2006 6:53AM
保存到该表的结果集被累积,直到您删除或截断该表。
> 注意
如果 sample_table 在其它数据库中,则必须提供它的用引号引起来的全限定名。
显示所有配置的 configure_value、system_value 和 run_value 列:
sp_monitorconfig "all", null, "full"
go
Usage information at date and time: Mar 23 2004 5:15PM
Name Configure Value System Value Run Value
Num_free Num_active Pct_act Max_Used Reuse_cnt Instance_Name
------------------------ ---------- ---------- -------
--------- ---------- ------- -------- --------- -------------------
additional network memory 0 2167876 2167876
1358436 809440 37.34 825056 0 NULL
audit queue size 100 0 100
100 0 0.00 0 0 NULL
disk i/o structures 256 0 256
256 0 0.00 29 0 NULL
heap memory per user 4096 563 4096
4096 0 0.00 0 0 NULL
kernel resource memory 4096 0 4096
3567 529 12.92 529 0 NULL
max cis remote connection 0 100 100
100 0 0.00 0 0 NULL
. . .
size of shared class heap 6144 0 6144
6144 0 0.00 0 0 NULL
size of unilib cache 0307032 307032 306216
816 0 .27 816 0 NULL
txn to pss ratio 16 0 16
400 0 0.00 0 0 NULL
使用 sp_monitorconfig 时,还存在一些其它注意事项:
- additional network memory
- audit queue size
- heap memory per user
- max cis remote connection
- max memory
- max number network listeners
- memory per worker process
- max online engines
- number of alarms
- number of aux scan descriptors
- number of devices
- number of dtx participants
- number of java sockets
- number of large i/o buffers
- number of locks
- number of mailboxes
- number of messages
- number of open databases
- number of open indexes
- number of open objects
- number of open partitions
- number of remote connections
- number of remote logins
- number of remote sites
- number of sort buffers
- number of user connections
- number of worker processes
- partition groups
- permission cache entries
- procedure cache size
- size of global fixed heap
- size of process object heap
- size of shared class heap
- size of unilib cache
- txn to pss ratio
服务器将排序缓冲区用于 update statistics、create index、order by、sort merge join、重新格式化(store_index)等排序操作。每个操作都可以使用一些排序缓冲区,但数量不得超过为 number of sort buffers 配置的值。如果运行多个具有排序操作的连接,则所使用的排序缓冲区数可能大于 number of sort buffers 的值。这是预期结果。但是,发出 sp_monitorconfig "number of sort buffers" 所显示的数量要高于已配置的值。
("number of user connections" + "number of worker processes") X "heap memory per user"
启动后,服务器会根据 heap memory per user 的值以及已配置用户连接数和工作进程数分配全局堆内存池,然后用户根据需要从全局堆内存池中获取堆内存。
sp_monitorconfig "heap memory per user" 按用户显示全局池的使用信息。sp_monitorconfig "heap memory per user" 显示的 Num_active 和 Max_Used 计数器表示全局堆内存池中使用的总内存,预计这些值大于为 heap memory per user 配置的值。
- Num_free – 指定当前未使用的可用元数据或辅助扫描描述符的数目。
- Num_active – 指定在高速缓存中安装的(即活动的)元数据或辅助扫描描述符的数目。
- Pct_active – 指定存入高速缓存的或活动的元数据或辅助扫描描述符的百分比。
- Max_Used – 指定自启动服务器后已在使用中的元数据或辅助扫描描述符的最大数目。
- Reuse_cnt – 指定是否重新使用元数据描述符以容纳服务器中增加的索引、对象或数据库。返回值为 Yes、No 或 NA(用于不支持重用机制的配置参数,例如 aux scan descriptors 的数目)。
<result_tbl_name> 使用以下语法创建表:
create table table_name(
Name varchar(35), Num_free int,
Num_active int, Pct_act char(6),
Max_Used int, Reuse_cnt int,
Date varchar(30))
所有结果信息都保存在该表中,不返回任何标准输出。
<number of sort buffers> 和 <txn to pss ratio>)依赖于配置的用户连接的数目,而其它配置参数(如 <max number of network listeners>)则依赖于引擎数。
<permission cache entries>,Num_free、Num_active、Pct_act 和 Max_Used 的值是每个连接值的平均值,然而,Reuse_cnt 是服务器范围值。
num_free、num_active、pct_act 和 max_used 的值。