数据库(informix)优化和备份策略方案指导

上传人:hjk****65 文档编号:111344432 上传时间:2022-06-20 格式:DOC 页数:35 大小:185.50KB
收藏 版权申诉 举报 下载
数据库(informix)优化和备份策略方案指导_第1页
第1页 / 共35页
数据库(informix)优化和备份策略方案指导_第2页
第2页 / 共35页
数据库(informix)优化和备份策略方案指导_第3页
第3页 / 共35页
资源描述:

《数据库(informix)优化和备份策略方案指导》由会员分享,可在线阅读,更多相关《数据库(informix)优化和备份策略方案指导(35页珍藏版)》请在装配图网上搜索。

1、 亿阳信通服务支持中心 NIOS DB(Informix)数据库优化和备份策略方案指导 NIOS DB(Informix)数据库优化和备份策略方案指导亿阳信通服务支持中心2011年05月版权所有 本产品或文档受版权保护,其使用、复制、发行和反编译均受许可证限制。未经亿阳及其授权者事先的书面许可,不得以任何形式、任何手段复制本产品及其文档的任何部分。目录目录3第一章 前言41.1目的41.2内容41.3谁应该读这本书4第二章 NIOS数据库优化52.1 基本DBS优化和调整52.2 Informix onconfig参数配置72.3 表结构及分片策略优化292.4 应用索引的优化30第三章 NI

2、OSDB备份和容灾策略323.1.备份策略和容灾323.2 .高可用性323.3. 数据压缩32第四章 常用提高性能的注意事项和出错查询334.1 合理利用索引334.2 SQL技巧334.3 View, PDQ, Stored Procedure, and Trigger344.4表被索处理344.5查询主键重复34第一章 前言1.1目的随着网优项目的推进,对数据粒度和范围需求造成数据量急剧膨胀。对原数据库构架不合理会造成难以适应生产的需要,对数据库进行格式优化就尤为重要,同样使用话务网管数据库的改造,根据现场情况,因地制宜的进行改造,会大大降低维护成本,提高生产效率。1.2内容针对省级网优

3、系统服务程序的要求,本指导描述了对INFORMIX 11.5 以上版本的优化关键点,以及备份和容灾参考,保障生产需要:*数据库版本建议 *DBS空间划分改造的指导建议 *系统配置*onconfig文件参数的修改建议 *表结构及分片策略的建议*索引优化建议和参考*备份和容灾方案建议1.3谁应该读这本书本指导适合在现场有一定维护经验,对INFORMIX维护达到中级维护水平。并熟悉操作系统和有基本的数据库开发经验。第二章 NIOS数据库优化此章介绍Informix 11.5优化指导内容:优化前准备n INFORMIX版本升级需要由于INFORMIX在技术升级和改造中,FC7版本以上相对问题比较少,建

4、议INFORMIX升级到11.5FC7以上。移动统一采购了融海服务,建议局方要求数据库版本升级。并且研发都是在11.5之上的版本进行开发,有很多技术在9.40上需要改造,这样会耗费现场很多精力,并且在研发支持下才能进行改造。比较麻烦,并且无法保障结果。n 优化调整空间需求如果对表空间的重新调整,在不影响正常使用的情况下,需要增加现有apmdbs空间容量进行表结构的调整。2.1 基本DBS优化和调整 1PLOGDBS 10G(数据量小的省6G就可以) LLOGDBS 20G 每个LOG空间开销1G左右 TMPDBS 20G*6 DPMDBS 30G*8 (由于底层表数据保留日期比较短,建议一次性

5、开到位,不在增加空间) APMDBS 50*13(如果大省可采用50G*17或80G*17(每次增加按相同比例增加,各现场应考虑现场实际存储的情况定) 对于原来数据分配10G左右一个的DBS,在空间增长过快时需要频繁增加CHUNK,带来问题是操作风险高,加错了可能造成数据库崩溃,并且在数据库管理上,会增加负荷,降低数据库效率。 2.在现网上进行调整命令 a)PLOGDBS(各现场可根据各现场实际进行修改,以下命令仅供参考) onspace c d plogdbs_n p /opt/informix/chunks/plogchk_n o 0 s 10240000 onmode uy #将数据库进

6、入quiescent状态下,进行逻辑日志和物理日志的修改 onparams p s 100000 d rootdbs y #将plog移回到rootdbs上 onparams p s 10000000 d plodbs_n y onmode m #切回online状态 回收原空间b)LLOGDBS onspaces c d llogdbs_n p /opt/Informix/chunks_n o 0 s 20480000repeat 20 onparams -a -d llogdbs_n -s 1000000将onconfig 的ontape设置成/dev/null将当前日志移动到新的DBS上

7、ontape s L 0删除原日志回收原空间 c)TMPDBS onspaces c d t tpmdbs_n1 p /opt/informix/chunks/tmpchk_n1 o 0 s 20480000 onspaces c d t tpmdbs_n2 p /opt/informix/chunks/tmpchk_n2 o 0 s 20480000 onspaces c d t tpmdbs_n3 p /opt/informix/chunks/tmpchk_n3 o 0 s 20480000 onspaces c d t tpmdbs_n4 p /opt/informix/chunks/t

8、mpchk_n4 o 0 s 20480000 onspaces c d t tpmdbs_n5 p /opt/informix/chunks/tmpchk_n5 o 0 s 20480000 onspaces c d t tpmdbs_n6 p /opt/informix/chunks/tmpchk_n6 o 0 s 20480000修改oncongfig 文件中DBSPACETEMP tmpdbs_n1,tmpdbs_n2,tmpdbs_n3,tmpdbs_n4,tmpdbs_n5,tmpdbs_n6重起数据库回收原空间d)DPMDBSselect tabname,nrows from s

9、ystables where tabname like “tpd%”;可根据nrows的大小对分片控制文件中的表next size进行规划,具体方法在表结构及分片策略优化内容中进行描述。onspace c d dpmdbs_n1 p /opt/Informix/chunks/dpmchk_n1 o 0 s 30960000onspace c d dpmdbs_n2 p /opt/Informix/chunks/dpmchk_n2 o 0 s 30960000onspace c d dpmdbs_n3 p /opt/Informix/chunks/dpmchk_n3 o 0 s 30960000

10、onspace c d dpmdbs_n4 p /opt/Informix/chunks/dpmchk_n4 o 0 s 30960000onspace c d dpmdbs_n5 p /opt/Informix/chunks/dpmchk_n5 o 0 s 30960000onspace c d dpmdbs_n6 p /opt/Informix/chunks/dpmchk_n6 o 0 s 30960000onspace c d dpmdbs_n7 p /opt/Informix/chunks/dpmchk_n7 o 0 s 30960000onspace c d dpmdbs_n8 p

11、/opt/Informix/chunks/dpmchk_n8 o 0 s 30960000迁移底层表例如tpd_radio_bts为niosdb中的一张表,,修改tpd_radio_bts.xml中的分片空间为新的dbs,并修改表名为tpd_tadio_bts_new, tpd_radio_bts.sql文件中的表名也同时修改为tpd_radio_bts_new.perl make_script.pl -i tpd_radio_bts.sql -c tpd_radio_bts.xml -db informix -o frag_tab.sql -f insert_dict_data.sqldba

12、ccess niosdb frag_tab.sqldbaccess niosdb insert_dict_data.sql运行分片滚动程序delete from TAC_FRAG_MANAGER where table_name=tpd_radio_bts; rename table tpd_radio_bts to tpd_radio_bts_old;rename table tpd_radio_bts_new to tpd_radio_bts ;update TAC_FRAG_MANAGER set table_name=tpd_radio_bts where table_name=tpd

13、_radio_bts_new;insert into tpd_radio_bts where scan_start_time=迁移当天的0点;之前数据可通过dbload或分段方式导回tpd_radio_bts表。删除tpd_radio_bts_old表。所有表都迁移完后,oncheck peoncheck_pe.txt检查dpmdbs18没有任何表了,onspaces d dpmdbs1onspaces d dpmdbs2onspaces d dpmdbs3onspaces d dpmdbs4onspaces d dpmdbs5onspaces d dpmdbs6onspaces d dpmd

14、bs7onspaces d dpmdbs8删除chunks下连接文件dpmchk18删除裸设备回收dpmdbs原空间。e)APMDBS操作方法同DPMDBS相同的处理办法,内容不在重复叙述。2.2 Informix onconfig参数配置 与性能有关参数大概如下: MULTIPROCESSOR1VPCLASScpu,num=15,noageVP_MEMORY_CACHE_KB0SINGLE_CPU_VP0CLEANERS32AUTO_AIOVPS1DIRECT_IO0LOCKS8000000DEF_TABLE_LOCKMODErowSHMVIRTSIZE819200SHMADD819200B

15、TSCANNERnum=5,threshold=50000,rangesize=-1,alice=6,compression=default OFF_RECVRY_THREADS50 BUFFERPOOLsize=2K,buffers=3000000,lrus=256,lru_min_dirty=50,lru_max_dirty=60 /*针对HP和SUN机器BUFFERPOOLsize=4K,buffers=3000000,lrus=256,lru_min_dirty=50,lru_max_dirty=60 /* 针对IBM AIX机器建立自动事物隔离级别,读取最后提交的事物,避免全表扫描U

16、SELASTCOMMITTED COMMITTED READ需要建立procedure sysdbopencreate procedure informix.sysdbopen()set lock mode to wait 30;end procedure ;如果在建数据库DBS时调整了page的大小为8K那么BUFFERPOOLsize=8K,据说选择大点的page,能够提高数据库效率,有条件本人实验后告诉大家效果。VPCLASScpu,num=15,noage中的num为cpu核数-1,不是个数以下是陕西网优的参数,供大家参考,不建议对不熟悉的的参数进行修改,Informix本身的机制有些

17、是有冲突的,当开启过大Fork进程数过多,会造成系统崩溃,不建议在现网频繁调试,如特殊需要开启最好征询IBM或融海。# Licensed Material - Property Of IBM# Restricted Materials of IBM# IBM Informix Dynamic Server# Copyright IBM Corporation 1996, 2010. All rights reserved.# Title: onconfig.std# Description: IBM Informix Dynamic Server Configuration Parameter

18、s# Important: $INFORMIXDIR now resolves to the environment# variable INFORMIXDIR. Replace the value of the INFORMIXDIR # environment variable only if the path you want is not under # $INFORMIXDIR.# For additional information on the parameters:# # Root Dbspace Configuration Parameters# ROOTNAME - The

19、 root dbspace name to contain reserved pages and# internal tracking tables.# ROOTPATH - The path for the device containing the root dbspace# ROOTOFFSET - The offset, in KB, of the root dbspace into the # device. The offset is required for some raw devices. # ROOTSIZE - The size of the root dbspace,

20、in KB. The value of # 200000 allows for a default user space of about # 100 MB and the default system space requirements.# MIRROR - Enable (1) or disable (0) mirroring# MIRRORPATH - The path for the device containing the mirrored # root dbspace# MIRROROFFSET - The offset, in KB, into the mirrored de

21、vice # Warning: Always verify ROOTPATH before performing# disk initialization (oninit -i or -iy) to# avoid disk corruption of another instance#ROOTNAME rootdbsROOTPATH /opt/informix1150/chunks/rootchkROOTOFFSET 0ROOTSIZE 2000000MIRROR 0MIRRORPATHMIRROROFFSET 0# Physical Log Configuration Parameters#

22、 PHYSFILE - The size, in KB, of the physical log on disk.# If RTO_SERVER_RESTART is enabled, the # suggested formula for the size of PHSYFILE # (up to about 1 GB) is:# PHYSFILE = Size of BUFFERS * 1.1# PLOG_OVERFLOW_PATH - The directory for extra physical log files# if the physical log overflows dur

23、ing recovery# or long transaction rollback# PHYSBUFF - The size of the physical log buffer, in KB#PHYSFILE 59999000 PLOG_OVERFLOW_PATH $INFORMIXDIR/tmpPHYSBUFF 512# Logical Log Configuration Parameters# LOGFILES - The number of logical log files# LOGSIZE - The size of each logical log, in KB# DYNAMI

24、C_LOGS - The type of dynamic log allocation.# Acceptable values are:# 2 Automatic. IDS adds a new logical log to the# root dbspace when necessary.# 1 Manual. IDS notifies the DBA to add new logical# logs when necessary.# 0 Disabled# LOGBUFF - The size of the logical log buffer, in KB#LOGFILES 57 LOG

25、SIZE 100000DYNAMIC_LOGS 2LOGBUFF 512# Long Transaction Configuration Parameters# If IDS cannot roll back a long transaction, the server hangs# until more disk space is available.# LTXHWM - The percentage of the logical logs that can be# filled before a transaction is determined to be a# long transac

26、tion and is rolled back# LTXEHWM - The percentage of the logical logs that have been# filled before the server suspends all other# transactions so that the long transaction being # rolled back has exclusive use of the logs# When dynamic logging is on, you can set higher values for# LTXHWM and LTXEHW

27、M because the server can add new logical logs# during long transaction rollback. Set lower values to limit the # number of new logical logs added.# If dynamic logging is off, set LTXHWM and LTXEHWM to# lower values, such as 50 and 60 or lower, to prevent long # transaction rollback from hanging the

28、server due to lack of # logical log space.# When using Enterprise Replication, set LTXEHWM to at least 30%# higher than LTXHWM to minimize log overruns.#LTXHWM 70LTXEHWM 80# Server Message File Configuration Parameters# MSGPATH - The path of the IDS message log file# CONSOLE - The path of the IDS co

29、nsole message file#MSGPATH /opt/informix1150/online.logCONSOLE /dev/console# Tblspace Configuration Parameters# TBLTBLFIRST - The first extent size, in KB, for the tblspace# tblspace. Must be in multiples of the page size.# TBLTBLNEXT - The next extent size, in KB, for the tblspace# tblspace. Must b

30、e in multiples of the page size.# The default setting for both is 0, which allows IDS to manage # extent sizes automatically.# TBLSPACE_STATS - Enables (1) or disables (0) IDS to maintain # tblspace statistics#TBLTBLFIRST 0TBLTBLNEXT 0TBLSPACE_STATS 1# Temporary dbspace and sbspace Configuration Par

31、ameters# DBSPACETEMP - The list of dbspaces used to store temporary# tables and other objects. Specify a colon# separated list of dbspaces that exist when the# server is started. If no dbspaces are specified, # or if all specified dbspaces are not valid, # temporary files are created in the /tmp dir

32、ectory# instead.# SBSPACETEMP - The list of sbspaces used to store temporary # tables for smart large objects. If no sbspace# is specified, temporary files are created in# a standard sbspace.#DBSPACETEMP tmpdbs1,tmpdbs2,tmpdbs3,tmpdbs4SBSPACETEMP# Dbspace and sbspace Configuration Parameters# SBSPAC

33、ENAME - The default sbspace name where smart large objects# are stored if no sbspace is specified during# smart large object creation. Some DataBlade# modules store smart large objects in this # location.# SYSSBSPACENAME - The default sbspace for system statistics # collection. Otherwise, IDS stores

34、 statistics # in the sysdistrib system catalog table.# ONDBSPACEDOWN - Specifies how IDS behaves when it encounters a# dbspace that is offline. Acceptable values # are:# 0 Continue# 1 Stop# 2 Wait for DBA action#SBSPACENAMESYSSBSPACENAMEONDBSPACEDOWN 2# System Configuration Parameters# SERVERNUM - T

35、he unique ID for the IDS instance. Acceptable # values are 0 through 255, inclusive.# DBSERVERNAME - The name of the default database server# DBSERVERALIASES - The list of up to 32 alternative dbservernames, # separated by commas#SERVERNUM 2DBSERVERNAME niosserver2DBSERVERALIASES niosserver2a# Netwo

36、rk Configuration Parameters# NETTYPE - The configuration of poll threads# for a specific protocol. The# format is:# NETTYPE ,# ,# ,(NET|CPU)# You can include multiple NETTYPE# entries for multiple protocols.# LISTEN_TIMEOUT - The number of seconds that IDS# waits for a connection# MAX_INCOMPLETE_CON

37、NECTIONS - The maximum number of incomplete# connections before IDS logs a Denial# of Service (DoS) error# FASTPOLL - Enables (1) or disables (0) fast # polling of your network, if your # operating system supports it.#NETTYPE tlitcp,2,100,NETLISTEN_TIMEOUT 60MAX_INCOMPLETE_CONNECTIONS 1024FASTPOLL 1

38、# CPU-Related Configuration Parameters# MULTIPROCESSOR - Specifies whether the computer has multiple# CPUs. Acceptable values are: 0 (single# processor), 1 (multiple processors or# multi-core chips)# VPCLASS cpu - Configures the CPU VPs. The format is:#VPCLASS cpu, num=,#,max=#,aff= | - |#( -/ ) #,n

39、oage#for example:#num=4,aff=(1-10/3) means assign 4 CPU VPs to processors#1,4,7,10# VP_MEMORY_CACHE_KB - Specifies the amount of private memory # blocks of your CPU VP, in KB, that the # database server can access. # Acceptable values are:# 0 (disable)# 800 through 40% of the value of SHMTOTAL# SING

40、LE_CPU_VP - Optimizes performance if IDS runs with# only one CPU VP. Acceptable values are:# 0 multiple CPU VPs # Any nonzero value (optimize for one CPU VP)#MULTIPROCESSOR 1VPCLASS cpu,num=15,noageVP_MEMORY_CACHE_KB 10240 SINGLE_CPU_VP 0# AIO and Cleaner-Related Configuration Parameters# VPCLASS ai

41、o - Configures the AIO VPs. The format is:# VPCLASS aio,num=,max=,aff=,noage # CLEANERS - The number of page cleaner threads# AUTO_AIOVPS - Enables (1) or disables (0) automatic management # of AIO VPs# DIRECT_IO - Specifies whether direct I/O is used for cooked# files used for dbspace chunks.# Acce

42、ptable values are:# 0 Disable# 1 Enable direct I/O# 2 Enable concurrent I/O#VPCLASS aio,num=1CLEANERS 128AUTO_AIOVPS 1DIRECT_IO 0# Lock-Related Configuration Parameters# LOCKS - The initial number of locks when IDS starts.# Dynamic locking can add extra locks if needed.# DEF_TABLE_LOCKMODE - The def

43、ault table lock mode for new tables.# Acceptable values are ROW and PAGE (default).#LOCKS 8000000DEF_TABLE_LOCKMODE row # Shared Memory Configuration Parameters# RESIDENT - Controls whether shared memory is resident.# Acceptable values are:# 0 off (default)# 1 lock the resident segment only# n lock

44、the resident segment and the next n-1 # virtual segments, where n 100# -1 lock all resident and virtual segments# SHMBASE - The shared memory base address; do not change# SHMVIRTSIZE - The initial size, in KB, of the virtual# segment of shared memory# SHMADD - The size, in KB, of additional virtual shared# memory segments# EXTSHMADD - The size, in KB, of each extension shared# memory segment# SHMTOTAL - The maximum amount of shared memory for IDS,# in KB. A 0 indicates no specific limit.# SHMVIRT_ALLOCSEG - Controls wh

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!