Informix 数据库维护指南v1.0 - 图文(8)

2019-03-15 15:07

Informix数据库维护指南

2) 3) 4)

页级锁 行级锁 键值锁

2.10.6 sysutils 库是否定期清理

sysutils数据库用于存放ONBAR备份操作的所有相关记录,因此经过一段时间后,systuils库会因为记录过多,性能会有所下降。建议定期使用 onsmsync命令清除过期的备份信息,包括存储端的备份。例如

onsmsync -i “1-6” #清除18个月前的所有备份信息 有如下sysutils的清理策略供参考: 1) 与后台存储的备份失效时间保持一致

2) 与rootdbs使用空间的策略保持一致,即空间剩余比例

3) 自定义失效时间策略,定期执行。执行的区间大于后台存储失效策略。

2.11 任务管理

2.11.1 Ready就绪队列及 Active 运行队列

监控Informix任务运行状态:

onstat -g rea命令的输出,从Ready队列的长度判断由于CPU资源紧张而造成的任务等待数。

onstat -g act命令的输出, 从 Active队列判断并行任务的数量、种类及是否有任务长期占用CPU VP执行(执行效率低) 就绪队列监控 onstat -g rea IBM Informix Dynamic Server Version 11.50.FC6 -- On-Line -- Up 13 days 23:10:38 -- 40749020 Kbytes 北京数据中心

第36页 共 97页

Informix数据库维护指南

Ready threads: tid tcb rstcb prty status vp-class name 5044115 c0000008a7f7ec40 c00000086688c660 1 ready 18cpu sqlexec 9170689 c0000008a98150e0 c0000008810de9a0 1 ready 16cpu sqlexec 运行队列监控 onstat -g act IBM Informix Dynamic Server Version 11.70.UC4 -- On-Line -- Up 18:45:32 -- 161084 Kbytes Running threads: tid tcb rstcb prty status vp-class name 8 4c5be018 0 1 running 1cpu* soctcppoll 9 4c5bed10 0 1 running 8shm* sm_poll 2.11.2 SQL执行时间

在Informix 11.50版本中,增加了一个新的特性,可以通过设置SQLTRACE参数记录SQL的执行情况,包括SQL的执行时间信息。 就绪队列监控 onstat -g his IBM Informix Dynamic Server Version 11.70.UC4 -- On-Line -- Up 19:02:30 -- 161084 Kbytes Statement history: Trace Level Med Trace Mode Global Number of traces 500 Current Stmt ID 1 Trace Buffer size 1000 Duration of buffer 4 Seconds Trace Flags 0x0000DF11 Control Block 0x4d54d6a8 Statement # 0: @ 0x4d54d6c0 Database: sysadmin Statement text: INSERT INTO command_history ( cmd_ret_msg, cmd_user, cmd_hostname, cmd_executed, cmd_ret_status ) VALUES (?, ?, ?, ?, ?) INSERT using table [ command_history ] 北京数据中心

第37页 共 97页

Informix数据库维护指南

Iterator/Explain

================

ID Left Right Sender Next Est Cost Est Rows Num Rows Partnum Type 1 0 0 0 0 1 1 1 1048843 Insert

Statement information:

Sess_id User_id Stmt Type Finish Time Run Time TX Stamp PDQ 34 500 INSERT 09:08:20 0.0209 2bccb2 0

Statement Statistics:

Page Buffer Read Buffer Page Buffer Write Read Read % Cache IDX Read Write Write % Cache 4 11 63.64 0 0 4 100.00

Lock Lock LK Wait Log Num Disk Memory Requests Waits Time (S) Space Sorts Sorts Sorts

12 0 0.0000 508 B 0 0 0

Total Total Avg Max Avg I/O Wait Avg Rows Executions Time (S) Time (S) Time (S) IO Wait Time (S) Per Sec 1 0.0209 0.0209 0.0209 0.0051 0.0202 47.8308

Estimated Estimated Actual SQL ISAM Isolation SQL Cost Rows Rows Error Error Level Memory 50 248 1 0 0 CR 70544 SQLTRACE的打开方式

ONCONFIG配置参数 SQLTRACE

SQLTRACE [level=low|high],[ntraces=number of traces],[size=size of each trace buffer],[mode=global|userid]

例如:

SQLTRACE level=high,ntraces=1000,size=20,mode=global

输出详细信息,跟踪1000条语句,每条语句最大20k的空间,全局模式

该参数需要重新启动才能生效。

或在sysadmin数据库内执行如下SQL,动态开启

EXECUTE FUNCTION admin ( \

不建议平时运行是开启此参数,待出现性能问题时动态打开

2.11.3 死锁

北京数据中心

第38页 共 97页

Informix数据库维护指南

死锁反应应用程序中存在的逻辑错误,Informix数据库会自动检查实例内的应用是否存在处于死锁的进程,如果存在将强制一方失败返回,另一方获得相应资源继续工作。

当遇到死锁时,应用会得到主要错误 -143 ISAM error: deadlock detected.

实例内死锁状态 onstat -p IBM Informix Dynamic Server Version 11.70.UC4 -- On-Line -- Up 19:15:22 -- 161084 Kbytes Profile dskreads pagreads bufreads êched dskwrits pagwrits bufwrits êched 4593 5360 259409 98.24 4754 7829 37223 87.23 isamtot open start read write rewrite delete commit rollbk 246233 10284 12286 128484 9616 1766 2380 4047 47 gp_read gp_write gp_rewrt gp_del gp_alloc gp_free gp_curs 2 0 0 0 0 0 2 ovlock ovuserthread ovbuff usercpu syscpu numckpts flushes 0 0 0 1.42 2.51 81 81 bufwaits lokwaits lockreqs deadlks dltouts ckpwaits compress seqscans 81 0 117922 10 0 0 1171 2531 ixda-RA idx-RA da-RA logrec-RA RA-pgsused lchwaits 0 619 1067 0 1011 3945 死锁操作涉及的表 onstat -g ppf IBM Informix Dynamic Server Version 11.70.UC4 -- On-Line -- Up 19:16:52 -- 161084 Kbytes Partition profiles partnum lkrqs lkwts dlks touts isrd iswrt isrwt isdel bfrd bfwrt seqsc rhitratio 0x100001 0 0 0 0 0 0 0 0 4069 0 0 100 0x100002 780 0 0 0 339 0 0 0 1105 1 7 100 0x100003 0 0 10 0 0 0 0 0 16 0 0 94 0x100004 5928 0 0 0 5846 0 0 0 12824 0 0 100 2.11.4 SQL错误

应用程序上线运行后,除了返回SQLCODE 100 和 0两个值,其他返回都可以视为在程序逻辑、使用上存在错误或有没有考虑到的情况。因此应经常检查应用程序的SQL返回码状态。

北京数据中心

第39页 共 97页

Informix数据库维护指南

应用的SQL返回码

onstat -g sql

IBM Informix Dynamic Server Version 11.70.UC4 -- On-Line -- Up 19:36:39 -- 161084 Kbytes

Sess SQL Current Iso Lock SQL ISAM F.E.

Id Stmt type Database Lvl Mode ERR ERR Vers Explain 27 sysadmin DR Wait 5 0 0 - Off 26 SELECT sysadmin DR Wait 5 -143 0 - Off 25 sysadmin DR Wait 5 0 0 - Off 查询具体的SQL信息

onstat -g ses ses_id

session #RSAM total used dynamic id user tty pid hostname threads memory memory explain 6253252 fesp - 103874 IPSSAP03 1 176128 140480 off

tid name rstcb flags curstk status 161004391 sqlexec 70000025a5e4c50 ---PR-- 8800 ready-

Memory pools count 2

name class addr totalsize freesize #allocfrag #freefrag

6253252 V 700000281142040 172032 34840 282 14 6253252*O0 V 70000025c007040 4096 808 1 1

name free used name free used overhead 0 6576 scb 0 144 opentable 0 8960 filetable 0 2048 log 0 16536 temprec 0 6304 keys 0 4632 ralloc 0 37184 gentcb 0 1744 ostcb 0 3400 sort 0 104 sqscb 0 26712 sql 0 72 rdahead 0 1120 hashfiletab 0 552 osenv 0 3784 buft_buffer 0 8432 sqtcb 0 8880 fragman 0 1016 udr 0 2280

sqscb info

scb sqscb optofc pdqpriority optcompind directives

700000259be4050 70000027851d028 0 0 0 1

Sess SQL Current Iso Lock SQL ISAM F.E.

Id Stmt type Database Lvl Mode ERR ERR Vers Explain

6253252 SELECT proddb CR Not Wait 0 0 9.35 Off

Current SQL statement :

北京数据中心

第40页 共 97页


Informix 数据库维护指南v1.0 - 图文(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:主要国家的电子签名法介绍

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: