1. 什么是Monitor Tables
Adaptive Server includes a set of system tables that contains monitoring and diagnostic information. The information in these tables provides you with a statistical snapshot of the state of Adaptive Server, which allows you to analyze the server for performance improvements. You can query these system tables in much the same way you currently query any other tables in Adaptive Server. For example, to display statistical information about I/O on Sybase devices:
Monitor Tables主要存储一些监控信息(当前运行的SQL,I/O统计信息,当前进程情况)比如monDeviceIO表(select * from monDeviceIO),存储了DISK IO有关的信息。 Monitor表默认是不安装的,需要运行installmontables 脚本来安装。 installmontables 脚本可以在sybase_HOME/scripts目录下找到, C:\dbserver\sybase15\ASE-15_0\scripts.
几点说明
(1) 所有系统表都是只读的,因为他们都在内存中
(2)只有有mon_role角色的用户可以查询这些表
2. Sybase中有哪些Monitor talbes
可以用一下SQL查询出
>>>select * from master..monTables ORDER BY TableName
3. 修改monitoring相关配置
基于性能上的考虑,有些Monitor功能默认没有启用,需要另外执行命令启用, 用“sp_configure Monitoring”可以找出所有Monitor相关的参数
(1) 用sp_configure Monitoring修改
比如要启用
>>>SELECT * FROM monSysSQLText
Error (12052) Collection of monitoring data for table 'monSysSQLText'
requires that the 'enable monitoring', 'SQL batch capture', 'sql text pipe max messages', 'sql text pipe active' configuration option(s) be enabled.
>>>sp_configure 'enable monitoring',1
>>>sp_configure 'sql text pipe active',1
>>>sp_configure 'sql text pipe max messages',1
(2) 直接修改SYBASE_HOME目录下的 <SERVER_NAME.cfg>文件
找到Monitor段
[Monitoring]
enable monitoring = DEFAULT
sql text pipe active = DEFAULT
sql text pipe max messages = DEFAULT
plan text pipe active = DEFAULT
plan text pipe max messages = DEFAULT
statement pipe active = DEFAULT
statement pipe max messages = DEFAULT
errorlog pipe active = DEFAULT
errorlog pipe max messages = DEFAULT
deadlock pipe active = DEFAULT
deadlock pipe max messages = DEFAULT
wait event timing = DEFAULT
process wait events = DEFAULT
object lockwait timing = DEFAULT
SQL batch capture = DEFAULT
statement statistics active = DEFAULT
per object statistics active = DEFAULT
max SQL text monitored = DEFAULT
performance monitoring option = DEFAULT
enable stmt cache monitoring = DEFAULT