sybase 的 mda表使用---用来查监控信息,比sp好用---新加配置过程--监控deadlock

sybase 的 mda表使用
 
 
sybase 的 mda表使用

sybase 的 mda表使用
Adaptive Server 12.5.0.3包含一组新的系统性能监测系统表,利用这些系统表中的信息对分析ASE服务器的性能非常方便.也就是我们常说的mda table.
mda 表的使用不需要license。mda 表在master数据库中,都以mon打头命名,它的内容都在内存中,是只读的。

mda表的安装和使用:
ase缺省不安装mda表,需要使用$SYBASE/ASE-12_5/scripts目录(对于 NT 为 %SYBASE%/ASE-12_5/scripts)中的 installmontables 脚本创建它们。安装之前需要执行
sp_addserver loopback, null, @@servername
来创建一个名为“loopback”的服务器
安装完成后,如果要使用mda表,必须有mon_role权限,执行
grant role mon_role to loginname
配置enable monitoring参数使可以使用mda表
sp_configure "enable monitoring",1
可以使用
sp_configure Monitoring
查看mda表使用可以调整的参数。
这些参数大多都是需要根据使用mda表进行调整的,有的参数是静态的,需要重启ase,注意
配置过程:
1.在isql中运行
sp_addserver loopback, null, @@servername
2.在isql中运行
grant role mon_role to loginname
3.在isql中运行
sp_configure "enable monitoring",1
4.在isql中运行
$SYBASE/ASE-12_5/scripts目录下的installmon脚本,需要将该脚本的内容拷贝到isql界面中,然后执行
5.与step4一样,运行文件为installmontables脚本
然后可以在isql中select * from 如下某一个表,看你需要查询哪一方面的信息;或者在程序中嵌入相应查询,一样的.


mda 表的简单说明
monTables
提供对所有监控表的说明
monTableParameters
提供对每个监控表的所有可选参数的说明。
monTableColumns
说明每个监控表的所有列
monState
提供有关 Adaptive Server 的总体状态的信息
monEngine
提供有关 Adaptive Server 引擎的统计信息
monDataCache
返回与 Adaptive Server 数据高速缓存有关的统计信息。
monProcedureCache
返回与 Adaptive Server 过程高速缓存有关的统计信息。
monOpenDatabases
提供与当前使用的数据库有关的状态信息和统计信息
monSysWorkerThread
返回与工作线程有关的服务器范围的统计信息。
monNetworkIO
返回网络 I/O 统计信息。
monErrorLog
从 Adaptive Server 错误日志返回最新的错误消息。
monLocks
为每个对象返回任何进程持有的以及请求的所有锁的列表。
monDeadLock
提供有关在 Adaptive Server 中已经出现的最新死锁的信息。
monWaitClassInfo
为所有等待类提供文本说明
monWaitEventInfo
为强制进程在 Adaptive Server 内等待的每种可能情况提供文本说明。
monCachedObject
返回当前在高速缓存中具有页的所有对象和索引的统计信息。
monCachePool
提供为所有高速缓存分配的所有池的统计信息。
monOpenObjectActivity
提供所有打开对象的统计信息。
monIOQueue
提供设备 I/O 统计信息,细分为每个设备上常规数据库和临时数据库的数据和日志 I/O
monDeviceIO
返回与设备有关的统计信息。
    sybase的io读写单位是page,一般是2K。
    但是不一定每次就读一页。一般读取8page。如果你的逻辑页是2K,则是16Kbytes。
monSysWaits
提供一个服务器范围的视图,指出进程等待事件的位置。
monProcess
提供有关当前正在执行的或等待的进程的详细统计信息。
monProcessLookup
提供一些信息,这些信息使应用程序、用户、客户机等可以跟踪进程。
monProcessActivity
提供有关进程活动的详细统计信息。
monProcessNetIO
提供每个进程的网络 I/O 活动信息。
monProcessObject
提供有关进程已经访问的对象的统计信息。
monProcessWaits
提供一个服务器范围的视图,指出进程等待事件的位置。
monProcessStatement
提供当前正在执行的语句的信息。
monProcessSQLText
提供当前正在执行的 SQL 文本
monSysPlanText
提供最新生成的文本计划。
monSysStatement
提供有关最近执行的语句的统计信息。
monCachedProcedures
提供当前存储在过程高速缓存中的所有过程的统计信息。
monSysSQLText
提供已经执行的最新 SQL 文本或当前正在执行的 SQL 文本。
monProcessProcedures
返回进程正在执行的所有过程的列表。


一个简单例子
看哪个进程占用cpu最多,它在干什么
select ps.SPID, ps.CpuTime,pst.LineNumber, pst.SQLText
from master..monProcessSQLText pst,
     master..monProcessStatement ps
where ps.SPID = pst.SPID
      and ps.CpuTime = (select max(CpuTime) from  master..monProcessStatement)
order by SPID, LineNumber


关于mda一个很好的存储过程,sypron的
/*
* SP_MDA.SQL
*
* Description
* ===========
* This file contains various stored procedures related to the so-called
* "MDA tables". These tables provide low-level monitoring information. They
* were introduced in ASE 12.5.0.3.
*
* This script installs the following procedures:
*    sp_mda_help - for searching through MDA table/columns names
*    sp_mda_io   - monitors logical I/O by T-SQL statements
*    sp_mda_wait - displays wait event info
*
* For usage information, specify '?' as the first parameter
* to these procedures.
*
*
* Installation
* ============
* Execute this script using "isql", using a login having 'sa_role'.
* The stored procedures will be created in the sybsystemprocs database.
*
*
* Notes
* =====
* - The MDA tables are a new feature, and a lot is still to be
*   discovered about them. Check back at [url=www.sypron.nl/mda]www.sypron.nl/mda[/url] for
*   new additions.
*
*
* Revision History
* ================
* Version 1.0    Jun-2003  First version
* Version 1.1    Aug-2004  Added sp_mda_wait; various improvements
* Version 1.2    Jan-2005  Adapted for case-insensitive sort order
*
*
* Copyright Note & Disclaimer :
* =============================
* This software is provided "as is"; there is no warranty of any kind.
* While this software is believed to work accurately, it may not work
* correctly and/or reliably in a production environment. In no event shall  
* Rob Verschoor and/or Sypron B.V. be liable for any damages resulting
* from the use of this software.
* You are allowed to use this software free of charge for your own
* professional, non-commercial purposes.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值