SYSIBM: 基本系统编目,不建议直接访问
SYSCAT: 默认授权给Public组.只读编目视图,一般通过这个来获取编目信息
SYSSTAT: 可更新编目视图,会影响优化器的优化策略
SYSFUN: 用户定义函数
SYSPROC: 存放一组系统的存储过程

如果你需要知道具体的每个编目表所产生的作用,可以去info center里面去搜索关键字: Road map to the catalog views, 可以得到所有以syscat.开头的编目视图(一般情况下用的也是这个).当然我还自己mark了一些牛大师的书里头提到的常用的对系统编目表的SQL语句,仅供参考(飞鹏大牛的书看完了还没做笔记...他的书里面也有许多有用的SQL语句):

1. 监控缓冲池命中率:
select substr(db_name,1,8) as DB_NAME, substr(bp_name,1,8) as BP_NAME, total_hit_ratio_percent as TOTAL_HR, data_hit_ratio_percent as DATA_HR, index_hit_ratio_percent as INDEX_HR, xda_hit_ratio_percent as XDA_HR from SYSIBMADN.BP_HITRATIO where bp_name not like ‘%IBMSYSTEM%’;
2. 监控PACKAGE CACHE大小:
with dbcfg1 as (select int(value) as pckcachesz from sysibmadm.dbcfg where name  ‘pckcachesz’ ) select pckcachesz as “Package Cache Size”, pkg_cache_lookups as “Lookups”, pkg_cache_inserts as “Inserts”, pkg_cache_num_overflows as “Overflows”, 100 * pkg_cache_size_top / (pckcachesz * 4096) as “%PKG Cache alloc” from dbcfg1, sysibmadm.snapdb;
3. 监控执行成本最高的SQL语句
select AGENT_ID, ROWS_SELECTED, ROWS_READ from sysibmadm.SNAPAPPL fetch first 10 rows only;
通过对比SELECT 和READ的值来进行判断.
4. 监控运行最长的SQL语句:
select substr(appl_name,1,15) as Appl_name, elapsed_time_min as Elapsed_Min, appl_status as Status, substr(auth,1,10) as auth_id, substr(inbound_comm_address,1,15) as IP_Address, substr(stmt_text,1,30) as SQL_Statement from sysibmadm.long_running_sql order by 2 desc;
5. 监控SQL准备和预编译时间最长的SQL语句:
select num_executions, average_execution_time_s(SQL语句平均执行时间), prep_time_ms(最长的SQL预编译时间), prep_time_percent(预编译时间占整个执行时间的百分比), substr(stmt_text,1,40) as SQL_TEXT from sysibmadm.query_prep_cost where average_execution_time_s > 0 order by prep_time_percent desc;
6. 监控执行次数最多的SQL语句:
select num_executions as Num_Excus, average_execution_time_s as Avg_times_s, stmt_sorts as Num_Sorts, sorts_per_execution as Sort_per_stmt, substr(stmt_text,1,35) as SQL_stmt from sysibmadm.top_dynamic_sql where num_execution > 0 order by 1 desc fetch first 5 rows only;
7. 监控排序次数最多的SQL语句:
select STMT_SORTS, SORTS_PER_EXECUTION, substr(stmt_text,1,60) as STMT_TEXT from sysibmadm.top_dynamic_sql by STMT_SORTS desc fetch first 5 rows only;
8. 监控LOCK WAIT时间:
select substr(ai.appl_name,1,20) as appl_name, substr(ai.primary_auth_id,1,10) as auth_id, ap.lock_waits as lock_waits, ap.lock_waits_time / 1000 as Total_waits_s, ap.lock_waits_time / ap.lock_waits as Avg_waits_ms from sysibmadm.snapappl_info ai, sysibmadm.snapappl ap where ai.agent_id = ap.agent_id and ap.lock_waits > 0;
9. 监控LOCK CHAIN:
select substr(ai_h.appl_name,1,0) as Hold_App, substr(ai_h.primary_auth_id,1,10) as Holder, substr(lw.appl_name,1,10) as Wait_app, substr(lw.authid,1,10) as Waiter, lw.lock_mode, lw.lock_object_type, substr(lw.tabname,1,10) as TabName, substr(lw.tabschema,1,10) as Schema, timestampdiff(2,char(lw.snapshot_timestamp - lw.lock_wait_start_time)) as waiting_s from sysibmadm.lockwaits lw, sysibmadm.snapappl_info ai.h where lw.agent_id_holding_lk = ai_h.agent_id;
10. 监控锁内存使用:
with dbcfg1 as (select float(int(value) * 4096) as locklist from sysibmadm.dbcfg where name = ‘locklist’), dbcfg2 as (select float (int(value) ) as maxlock from sysibmadm.dbcfg where name = ‘maxlock’) select dec ((lock_list_in_use/locklist) * 100,4,1) as % Lock_List, dec((lock_list_in_use/(locklist*(maxlocks/100))*100),4,1) as %_to_Maxlock(Maxlock的配置大小是多少), appls_cur_cons as Number_of_cons, lock_list_in_use/appl_cur_cons as Avg_Lock_Mem_per_Con_bytes from dbcfg1, dbcfg2, sysibmadm.snapdb;
11. 监控锁升级,死锁和锁超时:
select substr(ai.appl_name,1,10) as Application, substr(ai.primary_auth_id,1,10) as AuthID, int(ap.locks_held) as Locks, int(ap.lock_escals) as Escalations, int(ap.lock_timeouts) as Lock_timeouts, int(ap.deadlocks) as Deadlocks, int(ap.int_deadlock_rollbacks) as Dlock_Victim, substr(inbound_comm_address,1,15) as IP_Address from sysibmadm.snapappl ap, sysibmadm.snapappl_info ai where ap.agent_id =  ai.agent_id;
12. 监控全表扫描的SQL:
select substr(authid,1,10) as authid, substr(appl_name,1,20) as appl_name, percent_rows_selected from sysibmadm.appl_performance;
13. 检查page cleaner是否足够:
wuth db_snap as (select float(pool_drty_pg_steal_clns) as pg_steal, float(pool_drty_pg_thrsh_clns) as chg_pg_thrsh, float(pool_lsn_gap_clns) as softmax, float(pool_drty_pg_steal_clns + pool_drty_pg_thrsh_cls + pool_lsn_gap_clns) as total_clns from sysibmadm.snapdb) select dec(( pg_steal/toal_clns) * 100,4,1) as %steals, dec(( chg_pg_thrsh/total_clns) * 100,4,1) as %Threshold, dec(( softmax / total_clns) * 100,4,1) as %Softmax from db_snap;
14. 监控PREFETCHER是否足够:
with bp_snap as (select substr(br_name,1,30) as bp_name, unread_prefetch_pages, pool_async_data_reads + pool_async_index_reads as async_reads, pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads as Total_Reads from sysibmadm.snapbp where bp_name not like ‘IBMSYSTEM%’) select bp_name, unread_prefetch_pages, dec (100 *(Total_reads * Async_reads ) / Total_reads,5,2) as %Synch_Reads, dec (100 * unread_prefetch_pages /Total_reads, 5,2) as %Unread_Pages(异步I/O服务器预存取到缓冲池没有使用的页) from bp_snap;
15. 监控数据库内存使用(未启用STMM情况下):
select pool_id, pool_secondary_id, pool_current_size, pool_watermark from sysibmadm.snapdb_memory_pool;
16. 监控日志使用情况:
select int (total_log_used/1024/1024) as Log_used_Meg, int(total_log_available/1024/1024) as Log_Space_Free_meg, int((float(total_log_used) / float(total_log_used + total_log_available)) * 100) as Pct_Used, int (tot_log_used_top/1024/1024) as Max_Log_Used_Meg, int(sec_log_used_top/1024/1024) as Max_Sec_Used_Meg(日志使用的高水位), int(sec_logs_allocated) as Secondaries from sysibmadm.snapdb;
17. 监控占用日志空间最旧的交易:
select substr(ai.appl_status,1,20) as Status, substr(ai.primary_auth_id,1,10) as Authid, substr(ai.appl_name,1,15) as Appl_name, int(ap.UOW_LOG_SPAC_USED/1024/1024) as Log_Used_MB, Int(ap.appl_idle_time/60) as Idle_for_min, ap.appl_con_time as Connected_Since from sysibmadm.snapdb db, sysibmadm.snapappl ap, sysibmadm.snapappl_info ai where ai.agent_id = db.APPL_ID_OLDEST_XACT and ap.agent_id = ai.agent_id;
18. 监控存储路径:
select substr(type,1,20) as type, substr(path,1,50) as path from sysibmadm.dbpaths order by type;
19. 监控表空间使用情况:
select substr(tbsp_name,1,18), tbsp_type, tbsp_free_size_kb, tbsp_utilization_percent from sysibmadm.tbsp_utilization;
20. 利用系统编目表写脚本:
例1: 以表名为名称大批量导出表:
select ‘export to ‘||tabname||’.ixf of ixf select * from ‘||rtrim(tabschema)||’.’||tabname||’;’ from syscat.tables where type=’T’ and tabschema not in (‘SYSIBM’, ‘SYSCAT’, ‘SYSSTAT’, ‘SYSTOOLS’)”
例2: 大批量授权:
select ‘grant select on table ‘||rtrim(tabschema)||’.’||tabname||’ to user username; ‘ from syscat.tables where type = ‘T’ and tabeschema not in (‘SYSIBM’, ‘SYSCAT’, ‘SYSSTAT’, ‘SYSTOOLS’)”

db2系统表相应功能的更多相关文章

  1. 系统右键自定义功能-右键备份【C#】

    平时在某些公司发布网站的时候,都是手动备份文件,以免发布错误,做回滚使用.频繁的发布,在做备份的时候也会稍稍浪费点时间.当然在一些大的公司都会有一些自动发布系统,就不会出现这种问题了,对这种问题,我做 ...

  2. 《暗黑世界GM管理后台系统》部署+功能说明文档

    http://www.9miao.com/product-10-1073.html <暗黑世界GM管理后台系统>部署+功能说明文档 <暗黑世界GM管理后台系统>部署+功能说明文 ...

  3. 如何在不使用系统函数的情况下实现PHP中数组系统函数的功能

    PHP中为我们提供了各种各样的系统函数来实现我们需要的各种功能,那么,在不使用系统函数的情况下我们要怎样来实现这些功能呢?以下就是几种系统函数的实现方式. 首先,我们来定义一个数组: $arr= ar ...

  4. Android6.0 源码修改之屏蔽系统短信功能和来电功能

    一.屏蔽系统短信功能 1.屏蔽所有短信 android 4.2 短信发送流程分析可参考这篇 戳这 源码位置 vendor\mediatek\proprietary\packages\apps\Mms\ ...

  5. 基于ARM9和嵌入式Linux系统的多功能综合通信控制系统的框架

    基于ARM9硬件平台和嵌入式Linux系统的多功能综合通信控制系统的框架设计及各模块的功能.系统采用符合POSIX.1标准的C语言编写,实现了对下位机传送数据帧的采集.分析和存储,并能根据上位机的配置 ...

  6. Windows 10 如何使用「系统还原」功能备份系统状态和配置

    https://www.sysgeek.cn/windows-10-system-restore/ 在 Windows 10 系统中,「系统还原」功能旨在创建配置快照,并在检测到系统更改时将其工作状态 ...

  7. 学霸系统UI部分功能规格说明书

        发布人员:软件工程实践小队    发布内容:学霸系统UI部分功能规格说明书    版本:学霸V1.1版本         ◆Part 1:引言 1.1目的    本功能规格说明书的目的在于明确 ...

  8. 配置Linux系统实现dhcp功能

    配置Linux系统实现dhcp功能 1.背景及原理    DHCP(Dynamic Host Configuration Protocol,动态主机配置协议)通常被应用在大型的局域网络环境中,主要作用 ...

  9. [Xcode 实际操作]七、文件与数据-(23)UI Testing系统界面测试功能的使用

    目录:[Swift]Xcode实际操作 本文将演示UI Testing系统界面测试功能的使用. 如果项目中尚未引入界面测试功能,请点击项目属性面板->[General]面板左下角的[+]图标 - ...

随机推荐

  1. 查看tomcat运行状态

    实时查看tomcat并发连接数: netstat -na | grep ESTAB | grep 8080 | wc -l 实时查看apache并发连接数: netstat -na | grep ES ...

  2. git 使用https 和SSH 提交远程库小总结

    一.使用https提交远程库 首先已经git commit -m “注释” 本地仓库关联远程github服务器:git remote add origin  “https://XXXX.git” 提交 ...

  3. 003_Linux的Cgroup<实例详解>

    为什么要有cgroup Linux系统中经常有个需求就是希望能限制某个或者某些进程的分配资源.也就是能完成一组容器的概念,在这个容器中,有分配好的特定比例的cpu时间,IO时间,可用内存大小等.于是就 ...

  4. tomcat8配置SSL

    参考网址:http://www.micmiu.com/enterprise-app/sso/sso-cas-sample/#viewSource 1.生成证书 keytool -genkey -ali ...

  5. AS 中 Plugin for Gradle 和 Gradle 之间的版本对应关系

    Plugin for Gradle 和 Gradle 之间的版本对应关系 来源:https://developer.android.com/studio/releases/gradle-plugin. ...

  6. NodeJs>------->>第一章:Node.js介绍

    一:章节前言 二:Node.js概述 1:使用node.js能够解决什么问题 2:实现高性能服务器 3:非阻塞型I/O及事件环形机制 4:node.js适合开发的程序 三:node.js安装 一.No ...

  7. webpack 3之hash、chunkhash和contenthash三者的区别

    在使用webpack 3中,文件名的hash值可以有三种hash生成方式,那具体使用哪一种呢? 1.hash 如果都使用hash的话,所有文件的hash都是一样的,而且每次修改任何一个文件,所有文件名 ...

  8. vuejs之v-if-ajax异步请求数据遇到的坑

    场景: params是异步请求获得的数据是一个对象,对象中又有chefHealthInfos数组 渲染时候会报错: 分析: 这是因为可以把v-if看成渲染了两次,两次结果params分别为{},{ch ...

  9. java多线程快速入门(十四)

    使用atomicInteger解决了原子性问题(AtomicInteger保证每次只能一个线程操作count) package com.cppdy; import java.util.concurre ...

  10. strchr()的用法

    strchr()主要有2个最有用的用法: 第一个:搜索字符串在另一字符串中的第一次出现.并返回剩余的部分 $str = "hello_chrdai_1993"; $not_incl ...