免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: joey945
打印 上一主题 下一主题

DB2性能调整优化问题,请高手指点,急... [复制链接]

论坛徽章:
0
11 [报告]
发表于 2004-11-04 08:57 |只看该作者

DB2性能调整优化问题,请高手指点,急...

呵呵,还有好多参数要调,等会帮你看,现在忙

论坛徽章:
0
12 [报告]
发表于 2004-11-04 10:44 |只看该作者

DB2性能调整优化问题,请高手指点,急...

2004-11-03-10.20.17.187000 InstanceB2 Node:000
PID:616(db2syscs.exe) TID:292 Appid3984109.CF05.041103022021
buffer_pool_services sqlbGetVictimSlot Probe:727 Database:JINGMEI
DIA9999E An internal error occurred. Report the following error code :
"0xFFFFD12C".

String Title: PID:616 Node:000
Could not fix page for objID=21, tbspaceID=2, objType=0, parentObjID=21 parentTbspaceID=2.

"0xFFFFD12C"的意思是disk full,检查一下你的buffer pool,调大一些,另外,你的tempspace所在的分区是不是空间不够。还有编号是2的表空间是什么,检查一下了。

DB2在32位系统中是有内存限制的,你是把总量调的太高了。参考下面的公式计算一下:
buffer pools + dbheap + util_heap_sz + pkgcachesz + aslheapsz + locklist + approx 10% overhead
计算出来的总量参考下面:(不能超过呀)
AIX - 1.75 GB
Linux - 1.75 GB
Sun - 3.35 GB
HP-UX - approximately 800 MB
Windows - 2-3 GB (在 NT/2000 上的 boot.ini 中使用的是 ' 3GB' switch)

12万的数据量不算大,我这里实际应用中的很多表都至少有30多了columns,数据量都在亿以上,最大的表有200GB。调整好索引和分配合理的表分布,最重要的是检查sql是不是合理。很多问题不是数据库调整就能解决的,烂的sql能把你的DB跑死了。

论坛徽章:
0
13 [报告]
发表于 2004-11-04 12:53 |只看该作者

DB2性能调整优化问题,请高手指点,急...

兄弟,调过头了,400000都1.6G了吧,现在是151517吗?
除了满足楼上所说的容量限制外,那个容量总和也不应该超过你机器的物理内存数,不然反效果
db2 select * from syscat.bufferpools
db2 list tablespaces show detail
把结果弄上来kk

论坛徽章:
0
14 [报告]
发表于 2004-11-04 17:00 |只看该作者

DB2性能调整优化问题,请高手指点,急...

locktimeout 60
maxlocks 20
PCKCACHESZ 6000
sortheap 2000
dbheap 12000
locklist 10000
logfilsiz 2500

先调这些吧,不行的话在调,一张表有20几万条记录其实没什么。还有索引是不是合适。你可以用DB2ADVIS命令根据你的SQL语句来创建合适的索引。

论坛徽章:
0
15 [报告]
发表于 2004-11-04 18:43 |只看该作者

DB2性能调整优化问题,请高手指点,急...

首先感谢三位救星,多谢!

db2 select * from syscat.bufferpools的结果如下:

BPNAME             BUFFERPOOLID NGNAME             NPAGES      PAGESIZE    ESTORE

------------------ ------------ ------------------ ----------- ----------- ------

IBMDEFAULTBP                  1 -                       151517        4096 N     

db2 list tablespaces show detail的结果如下:(只有一个硬盘,分了四个区,C装OS,D装DB2,E放数据库备份,F放一些安装程序.三个tablespace都是安装时默认的,都在D上.目前D区已用1.81G,剩余2.42G,应该有空间啊,怎么报disk full呢?)

           Tablespaces for Current Database



Tablespace ID                        = 0

Name                                 = SYSCATSPACE

Type                                 = System managed space

Contents                             = Any data

State                                = 0x0000

   Detailed explanation:

     Normal

Total pages                          = 2887

Useable pages                        = 2887

Used pages                           = 2887

Free pages                           = Not applicable

High water mark (pages)              = Not applicable

Page size (bytes)                    = 4096

Extent size (pages)                  = 32

Prefetch size (pages)                = 16

Number of containers                 = 1

Minimum recovery time                = 2004-11-04-00.36.57.000000



Tablespace ID                        = 1

Name                                 = TEMPSPACE1

Type                                 = System managed space

Contents                             = System Temporary data

State                                = 0x0000

   Detailed explanation:

     Normal

Total pages                          = 1

Useable pages                        = 1

Used pages                           = 1

Free pages                           = Not applicable

High water mark (pages)              = Not applicable

Page size (bytes)                    = 4096

Extent size (pages)                  = 32

Prefetch size (pages)                = 16

Number of containers                 = 1



Tablespace ID                        = 2

Name                                 = USERSPACE1

Type                                 = System managed space

Contents                             = Any data

State                                = 0x0000

   Detailed explanation:

     Normal

Total pages                          = 207706

Useable pages                        = 207706

Used pages                           = 207706

Free pages                           = Not applicable

High water mark (pages)              = Not applicable

Page size (bytes)                    = 4096

Extent size (pages)                  = 32

Prefetch size (pages)                = 16

Number of containers                 = 1

Minimum recovery time                = 2004-08-12-06.24.07.000000


目前参数:
BUFFPAGE - 151517
DBHEAP - 1621
UTIL_HEAP_SZ - 50505
PCKCACHESZ - 4000
LOCKLIST - 6000
ASLHEAPSZ - 15
approx 10% overhead 约占1G内存的10% - 100M

LOCKTIMEOUT - 60
MAXLOCKS - 20
SORTHEAD - 256
LOGFILSIZ - 250

按上面的公式算起来,其它参数不变的话,BUFFPAGE应该是128000,目前是151517,不能再大了啊.myuhan兄提供的参数中,PCKCACHESZ 6000 dbheap 12000    locklist 10000和其它的几个加起来也超过了啊.怎么办?
oprs和huyuhui001对myuhan提供的参数有何高见吗?

另外,有些表是有好几个索引,进行增删改操作并reorg后,runstats只能按照其中一个索引来做或者都不做,那些索引我以前看到过不少是指示需要重组的,但runstats不能做,要怎么做才是合适的索引呢?把旧的索引删掉重建可以吗?

急盼大家的帮助!TKS!

论坛徽章:
0
16 [报告]
发表于 2004-11-05 01:32 |只看该作者

DB2性能调整优化问题,请高手指点,急...

1、楼主用的是SMS,db2empfa是个不错的方案,不过改后就改不回来了!
2、楼主又加了个BUFFERPOOL?能把:
  1. select a.tbspace,b.bpname,b.npages,b.pagesize from syscat.tablespaces a ,syscat.bufferpools b where a.bufferpoolid=b.bufferpoolid
复制代码

列出来看看吗?楼主会明白,一个Tbs只能使用一个BufferPool,而一个BufferPool可用于多个Tbs吧!
3、运行重整的有效方法是:runstats =>; reorg =>; rebind
4、151517的bufferpool对你1G的MEM来说该是太大了,调小一些,过大的BufferPool会使性能很低!
5、为什么不打开监视开关看看呢?

顺便贴一个关于BufferPool的不错的文章!
摘自《DB2 Magazine》By Roger Sanders

Buffer Pools
If you have any experience with DB2 UDB, you probably know that a buffer pool is an area of memory allocated to the DB2 Database Manager solely for caching data pages either as new data is added to a database or as data is retrieved from disk in response to a query. Buffer pools improve overall database performance by reducing disk input/output operations because data can be accessed much faster from memory than from disk. In fact, analyzing how buffer pools are created and used is the most important step when tuning a database for optimum performance.

Given the importance of buffer pools, every DBA should understand how DB2 UDB uses them. Here's a quick refresher course. When new data is added to a database, it's added to a new page in the buffer pool first. Eventually, that page is externalized to database storage. On the other hand, when data is retrieved from a database in response to a query, the DB2 Database Manager places the page (or pages) that contain the requested data into a buffer pool before passing the data itself onto the application or user that requested it. Each time a new query is processed, every available buffer pool is searched to see if the page that contains the data needed already resides in memory. If so, it's immediately passed on to the appropriate application or user. However, if the data requested can't be found in any of the available buffer pools, the DB2 Database Manager retrieves it from storage and copies it to a buffer pool before passing it on. Once a page has been copied to a buffer pool, that page stays in the buffer pool until the database is shut down or until the space it occupies is needed to store another page. (Because all data additions and modifications take place in the buffer pool first — modified pages are eventually flushed to disk — data stored in a buffer pool is always up-to-date.) When a buffer pool becomes full, the DB2 Database Manager selects pages to remove by examining when a page was last referenced, the likelihood that the page will be referenced again, the page type, and whether or not the page has been altered without externalizing the changes to disk. For example, a page that was retrieved in response to a query that was run 30 minutes ago would more likely be overwritten than a page that contains data for an update operation that hasn't yet been committed.

By default, DB2 UDB creates one buffer pool (named IBMDEFAULTBP) as part of the database creation process. On Linux and Unix platforms, this buffer pool is allocated 1,000 4KB pages of memory; on Windows platforms, this buffer pool is allocated 250 4KB pages. You can increase or decrease the number of 4KB pages this buffer pool can hold by selecting the appropriate action from the Buffer Pools menu found in the Control Center or by executing the ALTER BUFFERPOOL SQL statement. You can also create additional buffer pools using the Buffer Pools menu in the Control Center or by executing the CREATE BUFFERPOOL SQL statement.

Because buffer pools are so important, you should carefully consider how many buffer pools your implementation needs, how big each buffer pool should be, and how each buffer pool available should be used. In most environments, the number of buffer pools that can be used effectively depends on the amount of system memory available. If the total amount of memory available can hold only 10,000 4k pages (or less), it's often better to use a single large buffer pool than several small buffer pools. Using several small buffer pools can cause frequently accessed pages to be swapped in and out of memory more often, which, in turn, can lead to I/O contention for storage objects such as system catalog tables or repeatedly accessed user tables and indexes. However, if more memory is available, consider creating individual buffer pools for the following:

* Each temporary tablespace defined
* Tablespaces that contain tables that are accessed consistently and repeatedly by many short-duration update transactions
* Tablespaces that contain tables and indexes that are updated frequently
* Tablespaces that contain tables and indexes that are queried frequently but are updated infrequently
* Tablespaces that contain tables that are queried frequently in a random manner
* Tablespaces that contain data that is accessed by infrequently used applications
* Any tablespace that contains data and indexes you want to favor.

In most cases, larger buffer pools are better than smaller buffer pools. However, take into account the total amount of memory available as well as how the buffer pools will be used. If you have an application that performs many random access operations against a very large table, you should create and use a small buffer pool for that particular table. In such a situation, there's no need to keep data pages in buffer pool memory once they've been used to resolve a single query. On the other hand, if you have an application that frequently retrieves data from several small look-up tables, you should consider creating a buffer pool that's large enough to hold all of the data stored in these tables. With this design, the data can be loaded into memory once, allowing it to be accessed repeatedly without requiring additional disk I/O.

论坛徽章:
0
17 [报告]
发表于 2004-11-05 09:16 |只看该作者

DB2性能调整优化问题,请高手指点,急...

151517相对于你的内存都还是有点偏大了,120000差不多了,难道以现在这个值还会出现下面的类似这种错误?是数据库一被连接就会出现,还是使用一段时候后出现?

2004-11-03-14.41.56.921000 InstanceB2 Node:000
PID:616(db2syscs.exe) TID:584 Appid3984109.3507.041103063722
buffer_pool_services sqlbFreeUpSlot Probe:122 Database:JINGMEI

All pages in buffer pool 1 are in use.

String Title: PID:616 Node:000
Could not fix page for objID=2, tbspaceID=1, objType=128, parentObjID=2 parentTbspaceID=1.


另外那几个参数,像dbheap,sortheap等,适当的大些也是好的,你原先的值也确实小了点,但对你db2diag.log这些错误不会有什么影响

论坛徽章:
0
18 [报告]
发表于 2004-11-05 09:57 |只看该作者

DB2性能调整优化问题,请高手指点,急...

monitor switches我打开了table,lock,bufferpool,但terminate后再get dbm cfg显示6个monitor依然是OFF呢?

select a.tbspace,b.bpname,b.npages,b.pagesize from syscat.tablespaces a ,syscat.bufferpools b where a.bufferpoolid=b.bufferpoolid的结果如下:

TBSPACE            BPNAME             NPAGES      PAGESIZE
------------------ ------------------ ----------- -----------
SYSCATSPACE        IBMDEFAULTBP            151517        4096
TEMPSPACE1         IBMDEFAULTBP            151517        4096
USERSPACE1         IBMDEFAULTBP            151517        4096

db2empfa我运行过两三次,db2 disconnect db_name,db2 force applicaton all,db2 terminate,db2stop,db2start后运行但过了一段时间提示数据库有对象正在用,我就没再试了.要怎么办才可以运行成功呢?

连接数据库不是一开始就不行,每次不行的时候我就去重启一下appserver,然后能用一段时间,用一段时间之后连接数据库的页面就出不来了,这种状态持续一段时间不重启appserver就会所有的页面都出不来了.

我注意到当连接数据库的页面出不来的时候,我去执行db2 disconnect db_name,db2 force applicaton all,db2 terminate,db2stop,db2start后,那些页面依然是连不上,必须要在WebSphere的控制台重启appserver才可以,而且我们5:30PM下班后没什么人用了,前台搜索也屏蔽了,晚上我去看的时候也是跟白天一样上不去,所以我怀疑是不是WebSphere有什么问题?我去看了WebSphere\AppServer\logs下的一些日志文件,没发现什么有用的信息,不知道要怎样获得WebSphere的诊断日志信息?

我想干脆把DB2升级到8.1,WAS升级到5.x,但网上没找到这些软件下载,在该论坛搜到一个DB2 8.1的下载地,下下来后安装发现许可证只能有5个connect,也不能用.大家有什么好建议?

希望大家能继续帮我,解决问题,谢谢了!

论坛徽章:
0
19 [报告]
发表于 2004-11-05 12:35 |只看该作者

DB2性能调整优化问题,请高手指点,急...

joey945, 我感觉你的系统的问题不是单一的,而是有很多,这点不知道你意识到没有,不要搅在一起了

照你说的情况,那连接不上的问题肯定主要是websphere服务器上的问题了,参考我前面的回帖

而db2diag.log里的信息反映了你数据库上的问题,基本上,这是不相关的问题

现在的话,
1。你调整了db2的lock和bufferpool的一些值,那么db2diag.log的出错信息还会出现么?
2。把SystemOut.log, SystemErr.log贴出来kk吧

论坛徽章:
0
20 [报告]
发表于 2004-11-05 13:10 |只看该作者

DB2性能调整优化问题,请高手指点,急...

出问题前WebSphere的connection pool是500,servlet engine的并发连接数是500.后来我调小了好几个值的组合都没有用.现在是前者是500,后者是450.
oprn兄,我没有找到SystemOut.log和SystemErr.log,是不是要打开什么选项才能生成这两个日志文件?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP