当前位置:数据库 > DB2 >>

db2监视器,监视数据库执行语句

db2监视器,监视数据库执行语句
 
1)查看监视器选项 
    db2 get monitor switches; 
2)修改语句跟踪选项   www.zzzyk.com  
    db2 update monitor switches using statement on; 
3)创建语句监视器 
     windows: 
     db2 connect to dbname user db2admin using db2admin ; 
    db2 create event monitor state_event for statements write to file 'c:\state_event\'; 
    linux: 
    db2 connect to dbname user db2inst4 using db2inst4;     
    db2 create event monitor state_event for statements write to file '/home/db2inst4/state_event/'; 
4)激活监视器 
     mkdir c:\state_event 
    db2 set event monitor state_event state=1; 
  www.zzzyk.com  
5)运行应用程序 例如查询:select * from table_name; 
6)完成输出 
    db2 flush event monitor state_event buffer; 
7)关闭监视器 
     db2 set event monitor state_event state=0; 
    db2 update monitor switches using statement off; 
    drop event monitor state_event; 
8)格式化结果 
    db2evmon -path c:\state_event> c:\sql.txt; 
    db2evmon -path /home/db2inst4/state_event > /home/db2inst4/sql.txt; 
 
9)删除监视器 
    db2 drop event monitor state_event;
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,