DB2 查看缓冲池真实大小
2015-11-24 16:56
447 查看
DB2中,修改缓冲池大小的命令有两个选项,默认的是IMMEDIATE,也就是立刻生效。 另一种是DEFERRED, 它只是在系统表中做了修改,实际上没有生效,需要重新激活数据库生效,也就是使用视图SYSCAT.BUFFERPOOLS查到的,并不一定是真实大小,那么如何查看缓冲池真实大小呢?
If the statement is executed as deferred, the following is true: Although the buffer pool definition is transactional and the changes to the buffer pool definition will be reflected in the catalog tables on commit, no changes to the actual buffer pool will
take effect until the next time the database is started. The current attributes of the buffer pool will exist until then, and there will not be any impact to the buffer pool in the interim. Tables created in table spaces of new database partition groups will
use the default buffer pool. The statement is IMMEDIATE by default when that keyword applies.
>>-ALTER BUFFERPOOL--bufferpool-name---------------------------->
.-IMMEDIATE-.
>--+-+-----------+--+-------------------------------------+--SIZE--+-number-of-pages----------------+-+-><
| '-DEFERRED--' '-DBPARTITIONNUM--db-partition-number-' '-+-----------------+--AUTOMATIC-' |
| '-number-of-pages-' |
+-ADD DATABASE PARTITION GROUP--db-partition-group-name--------------------------------------------+
+-NUMBLOCKPAGES--number-of-pages--+----------------------------+-----------------------------------+
| '-BLOCKSIZE--number-of-pages-' |
'-BLOCKSIZE--number-of-pages-----------------------------------------------------------------------'
答案是使用MON_GET_BUFFERPOOL表函数。
参考测试如下:
$ db2 "create bufferpool bffpl1 immediate size 1000 PAGESIZE 4k"
DB20000I The SQL command completed successfully.
$ db2 "select substr(BPNAME, 1, 30) as BPNAME, BUFFERPOOLID, NPAGES, PAGESIZE from SYSCAT.BUFFERPOOLS"
BPNAME BUFFERPOOLID NPAGES PAGESIZE
------------------------------ ------------ ----------- -----------
IBMDEFAULTBP 1 -2 4096
BFFPL1 2 1000 4096
2 record(s) selected.
1.)
$ db2 "alter bufferpool bffpl1 size 1500"
DB20000I The SQL command completed successfully.
$ db2 "select substr(BPNAME, 1, 30) as BPNAME, BUFFERPOOLID, NPAGES, PAGESIZE from SYSCAT.BUFFERPOOLS"
BPNAME BUFFERPOOLID NPAGES PAGESIZE
------------------------------ ------------ ----------- -----------
IBMDEFAULTBP 1 -2 4096
BFFPL1 2 1500 4096
2 record(s) selected.
$ db2 "select substr(BP_NAME, 1, 30) as BP_NAME, BP_CUR_BUFFSZ from table(MON_GET_BUFFERPOOL('BFFPL1',-1))"
BP_NAME BP_CUR_BUFFSZ
------------------------------ --------------------
BFFPL1 1500
1 record(s) selected.
采用默认的方式,发现系统表里发生了变化,实际大小也改变了。
2.)
$ db2 "alter bufferpool bffpl1 DEFERRED size 2000"
DB20000I The SQL command completed successfully.
$ db2 "select substr(BPNAME, 1, 30) as BPNAME, BUFFERPOOLID, NPAGES, PAGESIZE from SYSCAT.BUFFERPOOLS"
BPNAME BUFFERPOOLID NPAGES PAGESIZE
------------------------------ ------------ ----------- -----------
IBMDEFAULTBP 1 -2 4096
BFFPL1 2 2000 4096
2 record(s) selected.
$ db2 "select substr(BP_NAME, 1, 30) as BP_NAME, BP_CUR_BUFFSZ from table(MON_GET_BUFFERPOOL('BFFPL1',-1))"
BP_NAME BP_CUR_BUFFSZ
------------------------------ --------------------
BFFPL1 1500
1 record(s) selected.
采用了DEFERRED,虽然系统表发生了变化(1500->2000),但缓冲池实际大小没变(1500->1500),必须重新激活数据库才生效。
$ db2 terminate
DB20000I The TERMINATE command completed successfully.
$ db2 connect to qsmiao
Database Connection Information
Database server = DB2/AIX64 9.7.6
SQL authorization ID = E97Q6C
Local database alias = QSMIAO
$ db2 "select substr(BP_NAME, 1, 30) as BP_NAME, BP_CUR_BUFFSZ from table(MON_GET_BUFFERPOOL('BFFPL1',-1))"
BP_NAME BP_CUR_BUFFSZ
------------------------------ --------------------
BFFPL1 2000
1 record(s) selected.
If the statement is executed as deferred, the following is true: Although the buffer pool definition is transactional and the changes to the buffer pool definition will be reflected in the catalog tables on commit, no changes to the actual buffer pool will
take effect until the next time the database is started. The current attributes of the buffer pool will exist until then, and there will not be any impact to the buffer pool in the interim. Tables created in table spaces of new database partition groups will
use the default buffer pool. The statement is IMMEDIATE by default when that keyword applies.
>>-ALTER BUFFERPOOL--bufferpool-name---------------------------->
.-IMMEDIATE-.
>--+-+-----------+--+-------------------------------------+--SIZE--+-number-of-pages----------------+-+-><
| '-DEFERRED--' '-DBPARTITIONNUM--db-partition-number-' '-+-----------------+--AUTOMATIC-' |
| '-number-of-pages-' |
+-ADD DATABASE PARTITION GROUP--db-partition-group-name--------------------------------------------+
+-NUMBLOCKPAGES--number-of-pages--+----------------------------+-----------------------------------+
| '-BLOCKSIZE--number-of-pages-' |
'-BLOCKSIZE--number-of-pages-----------------------------------------------------------------------'
答案是使用MON_GET_BUFFERPOOL表函数。
参考测试如下:
$ db2 "create bufferpool bffpl1 immediate size 1000 PAGESIZE 4k"
DB20000I The SQL command completed successfully.
$ db2 "select substr(BPNAME, 1, 30) as BPNAME, BUFFERPOOLID, NPAGES, PAGESIZE from SYSCAT.BUFFERPOOLS"
BPNAME BUFFERPOOLID NPAGES PAGESIZE
------------------------------ ------------ ----------- -----------
IBMDEFAULTBP 1 -2 4096
BFFPL1 2 1000 4096
2 record(s) selected.
1.)
$ db2 "alter bufferpool bffpl1 size 1500"
DB20000I The SQL command completed successfully.
$ db2 "select substr(BPNAME, 1, 30) as BPNAME, BUFFERPOOLID, NPAGES, PAGESIZE from SYSCAT.BUFFERPOOLS"
BPNAME BUFFERPOOLID NPAGES PAGESIZE
------------------------------ ------------ ----------- -----------
IBMDEFAULTBP 1 -2 4096
BFFPL1 2 1500 4096
2 record(s) selected.
$ db2 "select substr(BP_NAME, 1, 30) as BP_NAME, BP_CUR_BUFFSZ from table(MON_GET_BUFFERPOOL('BFFPL1',-1))"
BP_NAME BP_CUR_BUFFSZ
------------------------------ --------------------
BFFPL1 1500
1 record(s) selected.
采用默认的方式,发现系统表里发生了变化,实际大小也改变了。
2.)
$ db2 "alter bufferpool bffpl1 DEFERRED size 2000"
DB20000I The SQL command completed successfully.
$ db2 "select substr(BPNAME, 1, 30) as BPNAME, BUFFERPOOLID, NPAGES, PAGESIZE from SYSCAT.BUFFERPOOLS"
BPNAME BUFFERPOOLID NPAGES PAGESIZE
------------------------------ ------------ ----------- -----------
IBMDEFAULTBP 1 -2 4096
BFFPL1 2 2000 4096
2 record(s) selected.
$ db2 "select substr(BP_NAME, 1, 30) as BP_NAME, BP_CUR_BUFFSZ from table(MON_GET_BUFFERPOOL('BFFPL1',-1))"
BP_NAME BP_CUR_BUFFSZ
------------------------------ --------------------
BFFPL1 1500
1 record(s) selected.
采用了DEFERRED,虽然系统表发生了变化(1500->2000),但缓冲池实际大小没变(1500->1500),必须重新激活数据库才生效。
$ db2 terminate
DB20000I The TERMINATE command completed successfully.
$ db2 connect to qsmiao
Database Connection Information
Database server = DB2/AIX64 9.7.6
SQL authorization ID = E97Q6C
Local database alias = QSMIAO
$ db2 "select substr(BP_NAME, 1, 30) as BP_NAME, BP_CUR_BUFFSZ from table(MON_GET_BUFFERPOOL('BFFPL1',-1))"
BP_NAME BP_CUR_BUFFSZ
------------------------------ --------------------
BFFPL1 2000
1 record(s) selected.
相关文章推荐
- Android之获取手机上的图片和视频缩略图thumbnails
- 数据库链接字符串查询网站
- DB2实例管理
- DB2实例管理
- 保障MySQL数据安全的14个最佳方法
- mysql问答汇集
- DB2 自动递增字段实现方法
- 创建一个空的IBM DB2 ECO数据库的方法
- Access 2000 数据库 80 万记录通用快速分页类
- 开通一个数据库失败的原因的和解决办法
- 一个简单的asp数据库操作类
- IBM DB2 Connect简介(1)
- DB2 日期和时间的函数应用说明
- DB2 常用命令速查(备忘)
- DB2 常用命令小结
- DB2比较常用与实用sql语句总结
- db2 导入导出单个表的操作详解
- DB2新手使用的一些小笔记:新建实例、数据库路径不存在、客户端连接 .