• 如何配置监控表MonTables来实现ASE的监控功能


    Sybase ASE自12.5.0.3以来引入了一组监控表,称为:MonTables后者MDA tables。可以利用MDA表实现对sybase ASE的监控和诊断。监控表里面存储着对于ASE状态的统计、汇总信息的快照snapshot。我们可以像查询其他系统表(比如sysobjects、 sysindexes、syscolumns等)一样来查询这些监控表MonTables。

    在12.x版本中MDA表默认是没有安装的,需要我们手动进行安装。在ASE15.x中新建数据库服务器的时候就默认装上了。

    下面开始详细得介绍安装以及配置MDA的过程。

     (1) 检查参数:enable cis是否启用?如果没有启用,打开该参数

    sp_configure "enable cis"
    go
     Parameter Name                 Default     Memory Used Config Value Run Value    Unit                 Type
     —————————— ———– ———– ———— ———— ——————– ———-
     enable cis                               1           0            1            1 switch               static
    (1 row affected)
     

    (2) 查看sysservers系统表中是否有loopback这一条记录,如果没有,手动添加一个指向自己的远程服务器

    (注:在ASE12.5.4以及之后的版本中在创建数据库服务器的时候默认会添加一个loopback服务器。)

    use master
    go
    sp_helpserver
    go
     name        network_name   class        status                                                                   id cost
     ———– ————– ———— ———————————————————————— — —-
     SYB_BACKUP  TEST_BS        ASEnterprise timeouts, no net password encryption, writable , rpc security model A     1 NULL
     SYB_EJB     EJBServer      ASEJB        external engine auto start                                                2 NULL
     SYB_JSAGENT TEST_JSAGENT   ASEnterprise no timeouts, no net password encryption, writable , rpc security model A  4 1000
     SYB_JSTASK  TEST           ASEnterprise timeouts, no net password encryption, writable , rpc security model A     6 1000
     TEST        TEST           local                                                                                  0    0
     TEST_XP     TEST_XP        RPCServer    no timeouts, no net password encryption, writable , rpc security model A  3 1000
    (return status = 0)
    sp_addserver loopback,null,@@servername
    go
     

    -- Test this configuration:
    -- (NB: this step is no longer required in 15.0 ESD#2 or later)
    set cis_rpc_handling on
    go
    --
    -- Alternatively, run:
    --     sp_configure 'cis rpc handling', 1
    -- ...and disconnect/reconnect your session
    exec loopback...sp_who  -- note: 3 dots!
    go
    

    (3) 安装MDA系统表

    在unix的shell下执行:isql -Usa -Pyourpassword -Syourservername -i$SYBASE/$SYBASE_ASE/scripts/installmontables -o$SYBASE/$SYBASE_ASE/scripts/instmontables_log.txt

    在windows的命令行下执行:isql -Usa -Pyourpassword -Syourservername -i%SYBASE%\%SYBASE_ASE%\scripts\installmontables -o%SYBASE%\%SYBASE_ASE%\scripts\instmontables_log.txt

    (注:ASE15.x中不需要再安装mda表)

    (4) 给需要有监控权限的登录赋予mon_role角色

    use master
    go
    grant role mon_role to sa
    go

    use master
    go
    grant role mon_role to sa
    go
    
    
    

    (5) 检查测试基本的MDA配置信息

    1> select  * from master..monState
    2> go
     LockWaitThreshold LockWaits   DaysRunning CheckPoints NumDeadlocks DiagnosticDumps Connections MaxRecovery StartDate                  CountersCleared
     —————– ———– ———– ———– ———— ————— ———– ———– ————————– ————————–
                     5           0           0           0            0               0           9           5        Apr 24 2010  1:34PM        Apr 24 2010  1:34PM
    (1 row affected)
    1>
     

    (6) 启用所有的监控配置参数

    sp_configure "sql text pipe active",1
    go
    sp_configure "sql text pipe max messages",2000
    go
    sp_configure "plan text pipe active",1
    go
    sp_configure "plan text pipe max messages",1000
    go
    sp_configure "statement pipe active",1
    go
    sp_configure "statement pipe max messages",5000
    go
    sp_configure "errorlog pipe active",1
    go
    sp_configure "errorlog pipe max messages",1000
    go
    sp_configure "deadlock pipe active",1
    go
    sp_configure "deadlock pipe max messages",1000
    go
    sp_configure "wait event timing",1
    go
    sp_configure "process wait events",1
    go
    sp_configure "object lockwait timing",1
    go
    sp_configure "SQL batch capture",1
    go
    sp_configure "statement statistics active",1
    go
    sp_configure "per object statistics active",1
    go
    sp_configure "max SQL text monitored",256
    go

    其中参数:max SQL text monitored需要重启ASE服务器后才能生效。

    (7) 重启ASE后,就可以通过查询monTables来了解ASE的监控信息了。比如:查看当前会话执行的sql语句。

    1> sp_autoformat "monProcessSQLText"
    2> go
     SPID KPID    ServerUserID BatchID LineNumber SequenceInLine SQLText
     —- ——- ———— ——- ———- ————– —————————————————————————————————-
    ——————————————————————————————————————————————————–
       31 2228258            1      35          1              1 SELECT SPID=right(space(80)+isnull(convert(varchar(80),SPID),'NULL'),4), KPID=right(space(80)+isnull
    (convert(varchar(80),KPID),'NULL'),7), ServerUserID=right(space(80)+isnull(convert(varchar(80),ServerUserID),'NULL'),12), BatchID=right(space(80)+isnull
       31 2228258            1      35          1              2 (convert(varchar(80),BatchID),'NULL'),7), LineNumber=right(space(80)+isnull(convert(varchar(80),Line
    Number),'NULL'),10), SequenceInLine=right(space(80)+isnull(convert(varchar(80),SequenceInLine),'NULL'),14), SQLText=SUBSTRING(convert(varchar(255),SQLTe
       31 2228258            1      35          1              3 xt),1,252) FROM monProcessSQLText
    (3 rows affected)
    (return status = 0)

    备注:在ASE12.5.3及后续的版本中的某些罕见的情况下,配置参数"per object statistics active"会导致时间片的错误。这个bug已在ASE15.x中得到了修正。

    另外,ASE的MDA监控功能对系统的整体性能是有不小的影响的,据说要损耗20%多的ASE系能。所以,不建议在生产环境上配置MDA监控表;如果启用了监控表,也一定要在不使用监控功能的时候及时关闭监控参数。执行:

    sp_configure "enable monitoring",1
    go

    关于MDA监控表的使用,后面会有博文继续介绍…

    ————————————————————————————————-
    —- 本文为andkylee个人原创,请在尊重作者劳动成果的前提下进行转载;
    —- 转载务必注明原始出处 : http://www.dbainfo.net

  • 相关阅读:
    es6数组方法
    es5数组方法
    es6中的generator函数
    async、await
    CSS---文本属性及其属性值
    MySQL---查询某个字段内容中存不存在某个数据,与like不同(FIND_IN_SET(str,strlist))
    CSS---background属性及其属性值
    TP---时间查询(当日、本周、本月、本年)
    PHP---各种输出详解
    type=“text”只能输入数字!
  • 原文地址:https://www.cnblogs.com/mutuan/p/2141654.html
Copyright © 2020-2023  润新知