DB2数据库日常维护手册(示例)
DB2日常维护手册
DB2 日常维护手册目录DB2日常维护手册 ............................................................................................................... - 1 -一、DB2日常维护操作 ............................................................................................ - 1 -1.检查管理服务器是否启动.................................................................................... - 1 -2.检查DB2实例是否已经启动 ............................................................................... - 1 -3.查看表空间状态是否正常.................................................................................... - 1 -4.查看表的状态........................................................................................................ - 2 -5.查看磁盘空间........................................................................................................ - 2 -6.检查存储管理软件是否正常................................................................................ - 2 -7.检查数据库备份是否正常.................................................................................... - 2 -8.检查归档日志是否正确归档了............................................................................ - 3 -9.查看缓冲池的命中率............................................................................................ - 3 -10.查看当前运行最频繁的SQL,其命中率是否正常 ......................................... - 3 -11.查看当前连接的应用程序,有没有非法连接 ................................................ - 3 -12.检查有没有死锁 ................................................................................................ - 3 -13.对表和索引进行runstats .................................................................................. - 3 -14.检查表是否需要重组 ........................................................................................ - 4 -15.对需要重组的表进行重组 ................................................................................ - 4 -二、DB2日常维护月操作 ........................................................................................ - 4 -1.查看DB2日志 ....................................................................................................... - 4 -2.检查备份和日志是否都保存好了........................................................................ - 4 -三、DB2日常维护季度操作 .................................................................................... - 5 -1.通过快照监控器,查看系统性能如何 ................................................................ - 5 -2.数据库补丁级别.................................................................................................... - 5 -四、注意事项............................................................................................................ - 5 -1.不要删除活动日志文件........................................................................................ - 5 -2.注意交易日志存储空间........................................................................................ - 5 -3.按照系统的实际工作量配置日志空间 ................................................................ - 5 -4.设置正确数据库代码页........................................................................................ - 6 -5.检查许可证(License)安装情况 ........................................................................ - 6 -6.创建数据库前调整好系统时间............................................................................ - 6 -7.不要随便执行chown (chmod) –R (UNIX/Linux) ........................................... - 6 -8.归档模式设置........................................................................................................ - 6 -五、附:以脱机方式重组表 .................................................................................... - 7 -六、附:使用CLP 捕获数据库运行状况快照 ...................................................... - 7 -七、附:IBM DB2常用命令..................................................................................... - 8 -DB2日常维护手册一、DB2日常维护操作1.检查管理服务器是否启动用ps命令查看是否有dasusr1后台进程#ps -ef | dasusr1请确保管理服务器已经启动,如果没有启动,则按以下步骤启动管理服务器:以管理服务器用户(UNIX默认是DASUSR1)登录发出db2admin start命令如果是HA环境,则要保证在脚本中正确配置了启动命令2.检查DB2实例是否已经启动用ps命令查看是否有db2sysc后台进程#ps -ef | db2sysc也可以以DB2实例所有者登录,通过发出db2start命令来确保启动了实例(如果实例已经启动,则会告知SQL1026N 数据库管理器已激活;否则,将把实例启动起来)3.查看表空间状态是否正常以db2实例所有者登录#db2 list tablespaces show detail //在单分区上查看表空间的状态,正常返回0x0000 # db2_all list tablespaces show detail //在所有分区上查看表空间的状态可以使用LIST TABLESPACES 命令确定连接数据库中表空间的当前状态,可以使用SHOW DETAIL选项查看表空间的详细信息。
DB2 日常维护_官方
| August 9, 2005
© 2005 IBM Corporation
数据库监视器堆
命令:db2 get snapshot for dbm 输出: 内存池类型 = 数据库监视器堆 当前大小(以字节计) = 245760 高水位标记(以字节计) = 327680 已配置的大小(以字节计) = 278528
| August 9, 2005
© 2005 IBM Corporation
数据库编码
关于数据库的编码 db2 get db cfg for sample 数据库地域 数据库代码页 数据库代码集 数据库国家/地区代码 db2set DB2CODEPAGE=1386 = CN = 1386 = GBK = 86
| August 9, 2005
© 2005 IBM Corporation
表空间利用率及状态
命令:db2 list tablespaces show detail 输出: 表空间标识 =5 名称 = DMSTBS 类型 = 数据库管理空间 内容 = 任何数据 状态 = 0x0000 详细解释: 正常 总计页数 = 1000 可用页数 = 960 已用页数 = 96 可用页数 = 864 高水位标记(页) = 96 页大小(以字节计) = 4096 扩展数据块大小(页) = 32 预取大小(页) = 32 容器数 =1 最小恢复时间 = 2005-06-08-03.13.40.000000
利用率=当前大小/已配置的大小
| August 9, 2005
© 2005 IBM Corporation
数据库日常维护
常用命令 数据库健康状况分析 数据维护 注意事项 Q&A
| August 9, 2005
DB2数据库日常维护-REORG_TABLE
转)DB2日常维护——REORG TABLE命令优化数据库性能2009-04-24 16:18一个完整的日常维护规范可以帮助 DBA 理顺每天需要的操作,以便更好的监控和维护数据库,保证数据库的正常、安全、高效运行,防止一些错误重复发生。
由于DB2使用CBO作为数据库的优化器,数据库对象的状态信息对数据库使用合理的 ACCESS PLAN至关重要。
DB2 优化器使用目录统计信息来确定任何给定查询的最佳访问方案。
如果有关表或索引的统计信息已过时或者不完整,则会导致优化器选择不是最佳的方案,并且会降低执行查询的速度。
当数据库里某个表中的记录变化量很大时,需要在表上做REORG操作来优化数据库性能一、完整的REORG表的过程值得注意的是,针对数据库对象的大量操作,如反复地删除表,存储过程,会引起系统表中数据的频繁改变,在这种情况下,也要考虑对系统表进行REORG 操作。
一个完整的REORG表的过程应该是由下面的步骤组成的:RUNSTATS -> REORGCHK -> REORG -> RUNSTATS -> BIND或REBIND注:执行下面命令前要先连接数据库1 RUNSTATS由于在第二步中REORGCHK时可以对指定的表进行RUNSTATS操作(在REORGCHK时指定UPDATE STATISTICS),所以第一步事实上是可以省略的。
2 REORGCHK在对表数据进行许多更改之后,逻辑上连续的数据可能会位于不连续的物理数据页上,在许多插入操作创建了溢出记录时尤其如此。
按这种方式组织数据时,数据库管理器必须执行其他读操作才能访问顺序数据。
另外,在删除大量行后,也需要执行其他的读操作。
表重组操作会整理数据碎片来减少浪费的空间,并对行进行重新排序以合并溢出记录,从而加快数据访问速度并最终提高查询性能。
还可以指定根据特定索引来重新排序数据,以便查询时通过最少次数据读取操作就可以访问数据。
DB2最新维护手册
DB2维护手册目录DB2维护手册 (1)一、DB2入门-数据库实例 (5)二、DB2日常维护日操作 (20)1、检查管理服务器是否启动 (21)2、检查DB2实例是否已经启动 (21)3、查看表空间状态是否正常 (21)4、查看表的状态 (22)5、查看磁盘空间 (23)6、检查存储管理软件是否正常 (23)7、检查数据库备份是否正常 (24)8、检查归档日志是否正确归档了 (24)9、查看缓冲池的命中率 (24)10、查看当前运行最频繁的SQL,其命中率是否正常 (24)11、查看当前连接的应用程序,有没有非法连接 (25)12、检查有没有死锁 (25)13、对表和索引进行RUNSTATS (25)14、检查表是否需要重组 (25)15、对需要重组的表进行重组 (26)三、DB2日常维护月操作 (27)1、查看DB2日志 (27)2、检查备份和日志是否都保存好了 (27)四、DB2日常维护季度操作 (27)1、通过快照监控器,查看系统性能如何 (27)2、数据库补丁级别 (28)五、注意事项 (28)1、不要删除活动日志文件 (28)2、注意交易日志存储空间 (28)3、按照系统的实际工作量配置日志空间 (29)4、设置正确数据库代码页 (29)5、检查许可证(L ICENSE)安装情况 (30)6、创建数据库前调整好系统时间 (30)7、不要随便执行CHOWN (CHMOD)–R(UNIX/L INUX) (30)8、在归档日志模式下使用LOAD记得加NONRECOVERABLE参数 (31)六、附:以脱机方式重组表 (31)七、附:索引重组 (32)八、收集和更新统计信息的准则 (35)九、附:使用CLP 捕获数据库运行状况快照 (39)十、IBM DB2 日常维护汇总 (41)十一、DB2常用命令集 (51)一、DB2入门-数据库实例在本文中,我使用DB2 来指代DB2 通用数据库V8.1 for UNIX、Linux 和Windows。
DB2 简明运维手册
DB2 简明运维手册数据库启动数据库正常启动的流程包括两个步骤,首先启动数据库实例,在root用户下切换到实例用户su - db2inst1,执行命令db2start然后激活对应的数据库,执行命令: db2 activate db 数据库名。
直到出现:则数据库成功启动。
数据库停止停止数据库使用如下命令:在root用户下切换到实例用户su - db2inst1,执行命令db2stop force,直到出现:则数据库停止成功。
数据库参数DB2的参数分为实例级参数和数据库级参数,以及实例注册变量实例级参数:主要设置实例使用的TCP/IP端口,查看实例端口通过命令:db2 get dbm cfg数据库实例注册变量:确认设置了通信协议为TCPIP,命令如下:如果没有设置则通过命令db2set DB2COMM=tcpip进行设置。
数据库参数确认内存自动调整已经打开,否则连接到数据库并执行db2 update db cfg for sample usingSELF_TUNING_MEM ON设置数据库的缺省日志参数为如果需要修改日志参数,可以通过命令db2 udpate db cfg for 数据库名using 参数名参数值例如增大备用日志文件数量到50,则可以通过命令修改创建数据库在实例用户下,执行db2 "create <数据库名> on <目标路径> using codeset UTF-8 territory cn"这样创建的数据库缺省页面大小(pagesize)为4K(4096),字符集为UTF-8,如果要使用GBK字符集,则把UTF-8修改为GBK即可。
创建缓冲池(bufferpool)为了使用与缺省页面大小不一致的表空间,例如缺省页面大小为4K,但是需要使用32K页的表空间,就必须先创建页面大小为32K的缓冲池,命令如下:db2 "create bufferpool bp32k pagesize 32768"bp32k为缓冲池的名字,通常每种页面大小创建一个缓冲池即可,例如8K页面的缓冲池可以命名为bp8k。
DB2数据库管理最佳实践笔记-10日常运维
10.1 日常运维工具概述Runstats是run statistics的缩写,意思是收集统计信息,目的是为DB2优化器提供最佳路径选择;Reorg是重组的意思,目的是减少表和索引在物理存储上的碎片,提供性能;Reorgchk是重组前的检查Rebind是对一些包、存储过程或静态程序进行重新绑定。
几个工具的执行流程:首先通过Runstats收集表和索引的统计信息,然后执行Reorg重组,如果有必要则执行,然后再次收集统计信息。
最后,对于静态语句、存储过程等,执行Rebind绑定。
10.2 Runstats在系统运行一个查询的时候,优化器需要决定用某种方式来访问数据。
只有当DB2对表中的数据有一个大概的了解,才能知道每一步操作大约需要处理多少数据,返回多少行。
当优化器了解了这些信息后,就会根据一系列的运算,判定出各种访问途径所需要消耗的资源,然后从中选择一个消耗资源最少的方法。
最普通的Runstats就是统计表和索引中有多少行数据,有多少不同的数值。
Runstats命令使用DISTRIBUTION参数手机数据分布。
数据分布分为两种,一种叫做频率采样(Frequency),一种叫做百分比采样(Quantile)。
当收集数据分布时,两种采样方式都会被收集。
其中频率采样是手页脚内容1机表中拥有相同数量最多的几行,比如10000行数据中9000行为10,然后500行为9,然后100行为8,剩下的部分平均分布。
如果我们制定Frequency为3的话,那么系统就会记录下来有9000行10,500行9,然后100行8,剩下的部分在估算时则假定平均分布。
而百分比采样则是将整个10000行数据分成相等大小的若干段,然后记录每一段的段首和段尾的数值,当需要查询一个数据段时(比如C1>10 AND C1<15),就可以根据每一个数据段的启始数值加上段落的大小,估算出符合查询条件的记录数量。
理论上,数据分布收集的越细致越好。
Db2数据库系统日常管理和维护资料大全分析
Db2 V8 数据库系统日常管理和维护资料大全DB2中有关日期和时间的函数,及应用DAYNAME 返回一个大小写混合的字符串,对于参数的日部分,用星期表示这一天的名称(例如,Friday)。
DAYOFWEEK 返回参数中的星期几,用范围在1-7 的整数值表示,其中1 代表星期日。
DAYOFWEEK_ISO 返回参数中的星期几,用范围在1-7 的整数值表示,其中1 代表星期一。
DAYOFYEAR 返回参数中一年中的第几天,用范围在1-366 的整数值表示。
DAYS 返回日期的整数表示。
JULIAN_DAY 返回从公元前4712 年1 月1 日(儒略日历的开始日期)到参数中指定日期值之间的天数,用整数值表示。
MIDNIGHT_SECONDS 返回午夜和参数中指定的时间值之间的秒数,用范围在0 到86400 之间的整数值表示。
MONTHNAME 对于参数的月部分的月份,返回一个大小写混合的字符串(例如,January)。
TIMESTAMP_ISO 根据日期、时间或时间戳记参数而返回一个时间戳记值。
TIMESTAMP_FORMAT 从已使用字符模板解释的字符串返回时间戳记。
TIMESTAMPDIFF 根据两个时间戳记之间的时差,返回由第一个参数定义的类型表示的估计时差。
TO_CHAR 返回已用字符模板进行格式化的时间戳记的字符表示。
TO_CHAR 是V ARCHAR_FORMAT 的同义词。
TO_DA TE 从已使用字符模板解释过的字符串返回时间戳记。
TO_DA TE 是TIMESTAMP_FORMA T 的同义词。
WEEK 返回参数中一年的第几周,用范围在1-54 的整数值表示。
以星期日作为一周的开始。
WEEK_ISO 返回参数中一年的第几周,用范围在1-53 的整数值表示。
要使当前时间或当前时间戳记调整到GMT/CUT,则把当前的时间或时间戳记减去当前时区寄存器:current time - current timezonecurrent timestamp - current timezone给定了日期、时间或时间戳记,则使用适当的函数可以单独抽取出(如果适用的话)年、月、日、时、分、秒及微秒各部分:YEAR (current timestamp)MONTH (current timestamp)DAY (current timestamp)HOUR (current timestamp)MINUTE (current timestamp)SECOND (current timestamp)MICROSECOND (current timestamp)因为没有更好的术语,所以您还可以使用英语来执行日期和时间计算:current date + 1 YEARcurrent date + 3 YEARS + 2 MONTHS + 15 DAYScurrent time + 5 HOURS - 3 MINUTES + 10 SECONDS从时间戳记单独抽取出日期和时间也非常简单:DA TE (current timestamp)TIME (current timestamp)而以下示例描述了如何获得微秒部分归零的当前时间戳记:CURRENT TIMESTAMP - MICROSECOND (current timestamp) MICROSECONDS如果想将日期或时间值与其它文本相衔接,那么需要先将该值转换成字符串。
DB2日常维护汇总
6.从哪个版本后存储过程可以用SQL语句来创建?
7.1版后
7.DB2提供哪些关系扩展器?
文本扩展器TEXTEXTENDER
图象扩展器IMAGEEXTENDER
音频扩展器AUDIOEXTENDER
视频扩展器VIDEOEXTENDER
SELECT * FROM SYSIBM.SYSTABLES WHERE CREATOR='USER'
33.如何知道用户下的函数?
SELECT * FROM ERFUNCTION
SELECT * FROM sysibm.SYSFUNCTIONS
25.如何查看数据库服务器目录?
LIST NODE DIRECTORY
26.DB2实例的服务器的默认端口是?
50000
服务器名称为DB2CDB2
27.DB2UDB服务器端的认证类型有?
SERVER
SERVER_ENCRYPT
SELECT * FROM sysibm.SYSBUFFERPOOLS
44.DB2表的字段的修改限制?
只能修改VARCHAR2类型的并且只能增加不能减少.
22.常用管理DB2服务器实例的命令?
DB2ADMIN START 启动DB2管理服务器实例
DB2ADMIN STOP 停止DB2管理服务器实例
DASICRT UNIX 下创建DB2管理服务器实例
DASIDROP UNIX 下删除DB2管理服务器实例
如:
设定当前实例的一个参数
DB2SET PARAMETER=VALUE
设定一个全局级的参数
DB2SETPARAMETER=VALUE-G(小写)
XXX工商局DB2 Q复制配置维护手册
1、Q复制规划1.1主机和DB2的相关设置信息模式(归档日志模式)1.2Websphere MQ的相关配置信息1.3Q复制的配置信息1.4复制队列映射属性1.5通道测试cd /usr/mqm/samp/bin./amqsput SYSA.SENDQ QMSYSA./amqsget SYSB.RECVQ QMSYSB2、mq用户创建创建用户mqm和组mqm,并把组mqm加入到用户db2inst1和db2fenc1中。
3、mq software install解压缩mq软件,用smitty installp安装,创建大小50G的mqmvg 、mqmlv和文件系统mqm,挂载点/var/mqm,/var/mqm/log4、mq 队列和通道创建在dbsvr04上执行setclock dbsvr01进行与dbsvr01的时间同步,需要在/etc/hosts中添加dbsvr01和IP。
由于MQ的需要在dbsvr01和dbsvr04中/etc/hosts添加相互的IP和name 信息。
Service ip 和service name 也要添加。
Dbsvr04:/etc/hosts:10.0.1.41 dbsvr0110.0.1.44 dbsvr0410.0.1.45 dbserver //hacmp 中service IPMQ测试:Dbsvr01:$ crtmqm -q venus.queue.managerWebSphere MQ queue manager created.Creating or replacing default objects for venus.queue.manager.Default objects statistics : 58 created. 0 replaced. 0 failed.Completing setup.Setup completed.$ strmqmWebSphere MQ queue manager 'venus.queue.manager' starting.5 log records accessed on queue manager 'venus.queue.manager' during the log replay phase.Log replay for queue manager 'venus.queue.manager' complete.Transaction manager state recovered for queue manager 'venus.queue.manager'. WebSphere MQ queue manager 'venus.queue.manager' started.$ runmqsc5724-H72 (C) Copyright IBM Corp. 1994, 2008. ALL RIGHTS RESERVED.Starting MQSC for queue manager venus.queue.manager.define qlocal (orange.queue)1 : define qlocal (orange.queue)AMQ8006: WebSphere MQ queue created.end2 : endOne MQSC command read.No commands have a syntax error.All valid MQSC commands were processed.$ cd /usr/mqm/samp/bin/$ ./amqsput ORANGE.QUEUESample AMQSPUT0 starttarget queue is ORANGE.QUEUEabcddsfsdsdfdsenddbsvr04:$ crtmqm -q venus.queue.managerWebSphere MQ queue manager created.Creating or replacing default objects for venus.queue.manager.Default objects statistics : 58 created. 0 replaced. 0 failed.Completing setup.Setup completed.$ $ strmqmWebSphere MQ queue manager 'venus.queue.manager' starting.5 log records accessed on queue manager 'venus.queue.manager' during the log replay phase.Log replay for queue manager 'venus.queue.manager' complete.Transaction manager state recovered for queue manager 'venus.queue.manager'. WebSphere MQ queue manager 'venus.queue.manager' started.$ runmqsc5724-H72 (C) Copyright IBM Corp. 1994, 2008. ALL RIGHTS RESERVED.Starting MQSC for queue manager venus.queue.manager.define qlocal (orange.queue)1 : define qlocal (orange.queue)AMQ8006: WebSphere MQ queue created.:::end2 : endOne MQSC command read.No commands have a syntax error.All valid MQSC commands were processed.$ cd /usr/mqm/samp/bin$ ./amqsput ORANGE.QUEUESample AMQSPUT0 starttarget queue is ORANGE.QUEUEadsfsdfdsfsdfsdfsSample AMQSPUT0 end$$ ./amqsget ORANGE.QUEUESample AMQSGET0 startmessage <adsfsdfdsfsdfsdfs>dbsvr01:crtmqm -lc -d SYSA.XMITQ -u DEADLETTER -lp 20 -ls 10 -lf 10240 QMSYSA //创建MQ队列strmqm QMSYSA //起队列管理器endmqlsr -m QMSYSA //停队列管理器ps -ef | grep mq //查看队列管理器nohup runmqlsr -t tcp -p 1453 -m QMSYSA & //起监听ps –ef|grep lsr // 查看监听进程endmqm QMSYSA //停队列endmqlsr //停监听dltmqm QMSYSA//删除管理队列runmqsc QMSYSA //起MQ资源DEFINE QREMOTE('SYSA.SENDQ') RNAME('SYSB.RECVQ') RQMNAME('QMSYSB') XMITQ('SYSA.XMITQ')DEFINE QLOCAL('SYSA.XMITQ') USAGE(XMITQ) MAXDEPTH(1000000) DEFPSIST(YES) DEFINE QLOCAL('DEADLETTER') USAGE(NORMAL) MAXDEPTH(500000)ALTER QMGR DEADQ('DEADLETTER')DEFINE CHL ('SYSAtoSYSB') CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('10.0.1.44(1454)') XMITQ('SYSA.XMITQ') DISCINT (0) BATCHSZ (200)START CHANNEL ('SYSAtoSYSB')DEFINE CHL ('SYSBtoSYSA') CHLTYPE(RCVR) TRPTYPE(TCP) BATCHSZ(200)DEFINE QLOCAL('SYSA.ADMINQ') MAXDEPTH(500000) DEFPSIST(YES)DEFINE QLOCAL('SYSA.RESTARTQ') MAXDEPTH(500000) DEFPSIST(YES)End*************************runmqsc QMSYSAdis chstatus('SYSAtoSYSB') //显示running 通道状态正常dis chstatus('SYSAtoSYSB')1 : dis chstatus('SYSBtoSYSA')AMQ8417: Display Channel Status details.CHANNEL(SYSBtoSYSA) CHLTYPE(RCVR)CONNAME(10.0.1.44) CURRENTRQMNAME(QMSYSB) STATUS(RUNNING)SUBSTATE(RECEIVE)dis chstatus('SYSBtoSYSA')2 : dis chstatus('SYSBtoSYSA')AMQ8417: Display Channel Status details.CHANNEL(SYSBtoSYSA) CHLTYPE(RCVR)CONNAME(10.0.1.44) CURRENTRQMNAME(QMSYSB) STATUS(RUNNING)SUBSTATE(RECEIVE)*************************runmqsc QMSYSBdis chstatus('SYSBtoSYSA')runmqchl -c SYSAtoSYSB -m QMSYSA //如果没有错误信息显示,表明该channel成功运行runmqchl -c SYSBtoSYSA -m QMSYSA //如果没有错误信息显示,表明该channel成功运行********************************修改queue manager的CCSID:strmqmrunmqscdisplay qmgr // 检查当前queue manager的CCSID值alter qmgr ccsid(437)end*************************dbsvr04:crtmqm -lc -d SYSB.XMITQ -u DEADLETTER -lp 20 -ls 10 -lf 10240 QMSYSBstrmqm QMSYSBnohup runmqlsr -t tcp -p 1454 -m QMSYSB &runmqsc QMSYSBDEFINE QLOCAL('SYSB.RECVQ') MAXDEPTH(1000000) DEFPSIST(YES)DEFINE QREMOTE('SYSA.ADMINQ') RNAME('SYSA.ADMINQ') RQMNAME('QMSYSA') XMITQ('SYSB.XMITQ')DEFINE QLOCAL('SYSB.XMITQ') MAXDEPTH(1000000) USAGE(XMITQ) DEFPSIST(YES)DEFINE QLOCAL('DEADLETTER') USAGE(NORMAL) MAXDEPTH(500000)ALTER QMGR DEADQ('DEADLETTER')DEFINE CHL ('SYSBtoSYSA') CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('10.0.1.45(1453)') XMITQ('SYSB.XMITQ') DISCINT (0) BATCHSZ (200)START CHANNEL ('SYSBtoSYSA')DEFINE CHL ('SYSAtoSYSB') CHLTYPE(RCVR) TRPTYPE(TCP) BATCHSZ(200)DEFINE QMODEL('IBMQREP.SPILL.MODELQ') DEFSOPT(SHARED) MAXDEPTH(1000000) MSGDLVSQ(FIFO) DEFTYPE(PERMDYN)end****************************nohup runmqlsr -t tcp -p 1454 -m QMSYSB & //起监听runmqsc QMSYSBdis chstatus('SYSBtoSYSA') //显示running 通道状态正常dis chstatus('SYSBtoSYSA')dis chstatus('SYSAtoSYSB')1 : dis chstatus('SYSAtoSYSB')AMQ8417: Display Channel Status details.CHANNEL(SYSAtoSYSB) CHLTYPE(RCVR)CONNAME(10.0.1.45) CURRENTRQMNAME(QMSYSA) STATUS(RUNNING)SUBSTATE(RECEIVE)dis chstatus('SYSBtoSYSA')2 : dis chstatus('SYSBtoSYSA')AMQ8417: Display Channel Status details.CHANNEL(SYSBtoSYSA) CHLTYPE(SDR)CONNAME(10.0.1.45(1453)) CURRENTRQMNAME(QMSYSA) STATUS(RUNNING)SUBSTATE(MQGET) XMITQ(SYSB.XMITQ)EN)*********************************************修改队列管理器中的字符集命令:首先打开命令行窗口。
循序渐进db2笔记-日常维护
14.1.1 查看是否有僵尸进程
在UNIX中,若父进程在一定的时间内无法收集到状态信息,则系统就会残留一个defunct进程。因为defunct进程是已经停止的,所以使用杀死进程的方法来杀defunct进程是无效的。defunct进程不使用CPU或硬盘等系统资源,而只使用极少量的内存用于存储退出状态和资源使用信息。
select * from sysibmadm.TOP_DYNAMIC_SQL order by NUM_EXECUTIONS desc fetch first 5 rows only;
此语句返回执行频率最高的5个动态SQL语句的所有执行时间、排序执行次数和语句文本详细信息。
为了标识执行时间最长的动态SQL语句,请检查AVERAGE_EXECUTION_TIME_S值最大的5个查询:
select * from sysibmadm_EXECUTION_TIME_S desc fetch first 5 rows only;
14.2.7 监控排序次数最多的SQL语句
select STMT_SORTS,SORTS_PER_EXECUTION,substr(STMT_TEXT,1,60) as STMT_TEXT from TOP_DYNAMIC_SQL order by STMT_SORTS desc fetch first 5 rows only;
通过inspect命令检查数据库是否一致:
db2 inspect check database results keep db_check.out
db2inspf db_check.out db_check.txt #检查文件,查看数据库是否一致
14.1.3 查看诊断日志判断是否有异常
DB2常用管理维护命令
SELECT * FROM SYSCAT.PROCEDURES
绑定存储过程
db2 connect to bgj0 user db2 using pwd
db2 bind c:\dfplus.bnd
拷贝存储过程到服务器上的C:\sqllib\function目录中
=========DB2常用的命令======================================
启动数据库
db2start
停止数据库
db2stop
连接数据库
db2 connect to bgj0 user db2inst using password
读数据库管理程序配置
db2 rollforward db db3test to [timestamp] and complete
db2 rollforward db db3test to [timestamp] using local time and complete
========================================================================
db2expln -d 数据库名 -u 用户名 密码 -o 文件名|-t -c 生成包的模式名 -p 包名
=======================================================================================
要使用SQL调用语句重组表,使用admin_cmd过程发出执行命令:
=======================================================================
DB2 Automation Tool v4.1 for z OS 自动化数据库维护指南说明书
Automated End-to-End Database MaintenanceOctober 2011Automated End-to-EndDatabase MaintenanceHow to reduce your DB2 workloadand improve data availability usingDB2 Automation Tool v4.1 for z/OSJennifer NelsonProduct Specialist / Product ManagerRocket Software, Inc.C ONTENTSList of Figures (iii)1Today’s data challenges (1)2Automating database maintenance is the solution (1)2.1Conditional Maintenance (2)2.2Generate utility JCL automatically (4)2.3Using the DB2 administrative task scheduler to automatically executeutility JCL (8)3Evolve your strategy with an intelligent solution (12)References (xiii)L IST OF F IGURESFigure 1: Exceptions enable you to find what objects to include (2)Figure 2: Example - REORG exceptions (3)Figure 3: Integrating custom exceptions (4)Figure 4: Job Profiles are comprised of objects, exceptions and utilities (5)Figure 5: Build your Job Profile in batch or online (5)Figure 6: Automatically generating utility JCL (6)Figure 7: Result of batch Job Profile (6)Figure 8: Objects that match the exceptions are written to the TRIGGERS DD (7)Figure 9: Generated utility JCL contains only objects that match the exceptions (7)Figure 10: All utilities in the Utility Profile are generated into the utility JCL (8)Figure 11: DB2 Administrative Task Scheduler accessible via DB2 Automation Tool v4.1 (9)Figure 12: Adding JCL job to the scheduler (9)Figure 13: Generating JCL in DB2 Automation Tool and adding to Scheduler (10)Figure 14: Execute JCL at a specific time or during an interval (10)Figure 15: Utility JCL can also be added to the Scheduler (11)Figure 16: Schedule the resultant utility JCL with different parameters (12)1 Today’s data challengesAccording to industry experts, the amount of data is exploding in structured data, replicated data and unstructured data – all of which can be stored in a database such as DB2 forz/OS The amount of data stored in DB2 for z/OS is more than doubling every two years..At the same time, most DB2 for z/OS applications are global non-stop, requiring almost100% accessibility. These circumstances place heavy demands on the amount of timerequired to execute critical maintenance that, if not done, affects the performance of yourbusiness critical applications and your bottom line.Add to the challenge of exponential data growth, the current economic environment isshrinking the operational budgets of most companies. You need to justify each and everysoftware purchase. Companies are often operating with reduced IT staff dealing with anincreased workload. Maintaining optimal performance of your databases is as important to data application availability as ensuring a network remains online and available for non-stop business use. Database maintenance can be more time-consuming than you mightthink. Consider the following questions as they apply to your database maintenance:•Is your database maintenance routine? Routine database maintenance doesn’t mean that it is easy, quick or cost-effective.•Do you run a third party application? Often times, packaged vendor JCL is not optimized or timely. For example, your vendor JCL could use syntax that does notfollow best practices or routinely collect statistics, take an image copy or performREORGs on objects whether they’re needed or not.•What if an object doesn’t need specific maintenance, such as an image copy? Do you take one anyway just in case?•What if an object needs maintenance, but is either being skipped for maintenance or has the wrong maintenance run? Do you run the utility now, or do you wait untillater?•Will you be able to fit all of your critical maintenance jobs within the batch window?What happens if objects don’t have maintenance applied?•Is your maintenance process automated? How much time and effort is required by your staff?• Are there situations that require your DBA staff to interrupt other tasks to intervene and manage the maintenance window?2 Automating database maintenance is thesolutionCreating a strategy for running routine maintenance and automating that maintenance can help your DBA staff focus on more business critical tasks, while application data remainsavailable for business. The IBM DB2 Automation Tool for z/OS provides the solution toyour data maintenance challenges and moreover lets you have control of your objects,data availability and applications. It determines which objects need what maintenancewhen according to your business specifications. Using exception criteria to detect whichobjects or group of objects need what maintenance is an efficient way to locate only those objects in need; you no longer need to run packaged vendor utility JCL. With the DB2Automation Tool v4.1, exception jobs can be automatically run at intervals you determineby integrating with the DB2 Administrative Task Scheduler. By scheduling the exceptionjob to execute automatically at regular intervals to evaluate your objects, you will alwaysknow what objects need which maintenance. And, you will be able to automate executingthe utility jobs, eliminating any unnecessary DBA intervention. This paper will help anyone who is familiar with the DB2 Automation Tool learn how to use the DB2 AdministrativeTask Scheduler to fully automate database maintenance.2.1 Conditional MaintenanceWith over 180 exceptions, DB2 Automation Tool can help you find just those objects thatneed maintenance. Do you need to trigger an image copy only when certain conditionsoccur? Or do you need to trigger a reorg with a combination of conditions? The DB2Automation Tool Exceptions Profiles can help. Exception Profiles are simply a re-usablecollection of exceptions, or conditions, against which to evaluate objects. They can be used with any set of objects, called Object Profiles, to generate any kind of utility JCL.For example, the real time stats exceptions CLUSTERSENS and SCANACCESS can beused to evaluate when a REORG should take place. In the screen shot below, the column S contains an ‘A’ for the SCANACCESS exception, which is an AND condition. This means that both the CLUSTERSENS condition and the SCANACCESS condition must be metbefore the object will be included in the utility.Figure 1: Exceptions enable you to find what objects to include.Scrolling right will display an explanation of the exceptions, as shown below. With acomplete description of the exception conditions, you can make a comprehensive decision on which exceptions to set to trigger just the objects you need.Figure 2: Example - REORG exceptions.Select any combination of DB2 catalog statistics, SYSCOPY information, MVS catalog statistics, DB2 display status information or real time exception conditions to trigger just the objects that meet those criteria. Optionally, you can have the DB2 Automation Tool run a RUNSTATS utility to evaluate your object using current statistics. You can elect to store the new statistics by setting UPDATE to ALL, ACCESSPATH, or SPACE. You can also set UPDATE to NONE to enable only the Exception Profile to evaluate current statistics but not store those values in the catalog.The Automation Tool is also flexible enough to allow you to supply input that is not defined in the product. This can be a user-supplied formula, user-written REXX exec, assembled load module or stored procedure with your customized exceptions to evaluate against your objects. You provide the load module name, REXX exec name, or stored procedure name you want to execute as shown in the example below. The load module or REXX exec is loaded into memory once and called for each object within the associated Object Profile. The stored procedure can be called in three different ways, depending on what you want it to do and how you want it to process your objects. You may elect to process your stored procedure either before the DB2 Automation Tool exception criteria evaluation occurs, as the criteria and objects are being evaluated, or after the evaluation has completed. Enter your stored procedure name in the appropriate field where you want the DB2 AutomationTool to run the stored procedure.Figure 3: Integrating custom exceptions.Combine your own exceptions in a load module, REXX exec or stored procedure with any of the exceptions provided by DB2 Automation Tool to meet your needs. This level ofscalability and flexibility lets you tailor the DB2 Automation Tool to meet your company’sneeds.2.2 Generate utility JCL automaticallyThe DB2 Automation Tool can help with the frequency of when your objects are evaluated whether it’s once a week or daily for your business-critical objects. The DB2 AutomationTool can be executed as needed or placed in a scheduler to be executed at regularintervals with no intervention from the DBA.To generate utility JCL, a Job Profile must contain at least one Object Profile, which is a re-usable list of objects, and one Utility Profile, which is a list of utilities for which you want to generate JCL. This enables you to generate a utility for all objects within an Object Profile.But to conditionally generate utility JCL for only objects that meet or exceed exceptioncriteria, an Exception Profile must be added to the Job Profile. Using this method, you can easily generate utility JCL for only those objects that need maintenance, enabling you tosave on CPU consumption and reducing the amount of elapsed time required to runmaintenance, thus improving data availability.If, for example, you must take an image copy each week for just those objects that need it, you can re-run the Job Profile that contains the exception criterion for running an imagecopy and see which objects are generated into the utility JCL. That utility JCL can then be added to a job scheduler, such as the DB2 administrative task scheduler, to run during the next maintenance window.In this example below, the Job Profile contains three pieces of information: the ObjectProfile called “Reorg Avoidance Objs”, a set of utilities and corresponding options in aUtility Profile called “Reorg Avoidance Util”, and a set of exception criteria in an Exception Profile called “Reorg Avoidance Excp”.Figure 4: Job Profiles are comprised of objects, exceptions and utilities.In this example, the Job Profile “Batch Evaluation” is being generated to run in batch mode. This means that each time this Job Profile is “built”, a batch job will be created. This batch job, called REORGB, will evaluate the objects in the Object Profile against the exception criteria in the Exception Profile. Any object that matches the exceptions will be generatedinto the utility JCL, which is also created when running this batch job.Figure 5: Build your Job Profile in batch or online.The second pop-up window enables you to specify the PDS data set and member nameinto which the resultant utility JCL will be generated.Figure 6: Automatically generating utility JCL.The JCL to evaluate the objects is presented in an ISPF edit panel to review. It is this JCL that you can add to a scheduler to execute at regular intervals. By running this batch JCL job regularly, you can be sure that only those objects that need a REORG run will be included.Figure 7: Result of batch Job Profile.When the JCL is executed, DB2 Automation Tool evaluates the objects against the exceptions defined in the Exception Profile. In the screen shot below, the TRIGGERS DD in the job output lists the exceptions defined in the Exception Profile, and lists those objects that met or exceeded the defined exception. In this example, the tablespace AUOCOPY met both the CLUSTERSENS exception and the SCANACCESS exception and will therefore be included in the utility JCL.Figure 8: Objects that match the exceptions are written to the TRIGGERS DD.As a result, the utility JCL is built with the tablespace AUOCOPY included in the utility JCL.First, a RUNSTATS utility is generated, as shown in the screen shot below.Figure 9: Generated utility JCL contains only objects that match the exceptions.Further down in the utility JCL, the REORG TABLESPACE utility is generated and showstablespace AUOCOPY included in the REORG TABLESPACE utility as well. The utilitiesRUNSTATS and REORG TABLESPACE were inlcuded in the Utility Profile. Anycombination of the available DB2 utilities can be generated.Figure 10: All utilities in the Utility Profile are generated into the utility JCL.The resultant utility JCL can then be executed on demand, or added to a job scheduler to run during a specific batch window. Job Profiles can be created to build utility JCL fortaking image copies, for updating statistics, for running REORGs or for any other routinemaintenance your company requires.By running a Job Profile at regular intervals to look for objects that need maintenance and to generate utility JCL, routine database maintenance can be much less manual and error-prone and allow your DBA staff to pursue other tasks.2.3 Using the DB2 administrative task scheduler toautomatically execute utility JCLDo you have a job scheduler to run the Job Profiles or the resultant utility JCL in batch? Or do you manually run the utility JCL as needed? The generated utility jobs created by DB2 Automation Tool can be manually added to any job scheduler by the user. But if you arerunning on DB2 v8 or higher, you can now integrate DB2 Automation Tool v4.1 with theDB2 Administrative Task Scheduler and automatically execute any JCL. By selectingoption 12 from the main DB2 Automation Tool menu, you can invoke the Db2administrative task scheduler to add a job to the scheduler.Figure 11: DB2 Administrative Task Scheduler accessible via DB2 Automation Tool v4.1.From the DB2 Admin Task Scheduler panel, you can create a new batch job to execute during a specific time interval, view the results of a task that has already run, update atask, or delete a task.Figure 12: Adding JCL job to the scheduler.The benefit of integrating with the DB2 administrative task scheduler is when you buildyour Job Profile as shown in the screen shot below.Figure 13: Generating JCL in DB2 Automation Tool and adding to Scheduler.When building your Job Profile that evaluates exceptions and generates maintenance utility JCL, the options ‘Schedule Job’ and ‘Update Options’ enables you to add your Job Profile to the DB2 administrative task scheduler so that it will run at regular intervals, or just once; which ever method you choose.In the example below, the Job Profile “Batch Evaluation” is being added to the DB2 administrative task scheduler. The options presented on this panel are specific to the DB2 administrative task scheduler, and their descriptions can be found in the DB2 Administration Guide.The fields Begin Timestamp and End Timestampe enable you to define the exact time you want to execute this JCL. However, since we want this Job Profile to run at regular intervals, the Interval Options have been defined instead. This batch JCL will execute every Saturday of the month throughout the year at 12 noon to evaluate the objects in the corresponding Object Profile that need a RUNSTATS and a REORG run.Figure 14: Execute JCL at a specific time or during an interval.The values in the Point in Time fields are:Position 1: Minute. Valid values are 0 through 59.Position 2: Hour. Valid values are 1 through 23.Position 3: Day of the Month. Valid values are 1-31.Position 4: Month. Valid values are 1 through 12, where 1 is January. Three-character strings are also allowed, i.e., JAN, FEB, etc.Position 5: Day of the week. Valid values are 0 through 7, where 0 or 7 is Sunday. Three-character strings are also allowed, i.e., SUN, SAT, etc.Ranges and lists are allowed. Ranges are simply two values separated by a hyphen, and mean all values are inclusive. Lists are simply two or more values separated by a comma, and mean only those values are included.When you have completed adding the Job Profile to the DB2 administrative task scheduler, you can then add the utility JCL jobs to the DB2 administrative task scheduler, too. You will see the same 2 options as before, ‘Schedule Job’ and ‘Update Options’.Figure 15: Utility JCL can also be added to the Scheduler.When the panel Schedule DB2 Admin Task is displayed, you will specify when the resultant maintenance utility JCL should be run. Remember that the previous DB2 admin task panel enabled you to define when to run the Job Profile that evaluates your obejcts against the exception criteria and generates utility JCL. This time, you are defining when to run the actual utilities themselves.In this example, the generated maintenance utility jobs will run between the hours of midnight and 3 AM each Sunday. The field ‘Exectution Threads’ specifies that up to 5 jobs can run at once.Figure 16: Schedule the resultant utility JCL with different parameters.3 Evolve your strategy with an intelligentsolutionThe maintenance utility jobs that were generated by DB2 Autiomation Tool can now bescheduled and automatically run with DB2 Automation Tool’s interface to the DB2administrative task scheduler. Now, you can automate your database maintenancestrategy with DB2 Automation Tool from start to finish; from finding which objects to include to generating and submitting utility JCL. And your DBA intervention can be reduced to aminimum, allowing you to spend your time on other business critical tasks, while stillrunning important database maintenance in the background. The combination of DB2Automation Tool v4.1 for z/OS and the DB2 Administrative Scheduler allow you to fullyautomate your database maintenance to achieve maximum control and availability of your critical DB2 objects, while minimizing the system and staff resources that cost you time andmoney.R EFERENCESIBM DB2 Automation Tool for z/OS v4.1 User’s Guide, SC19-3494-00IBM DB2 Version 9.1 for z/OS Administration Guide, SC18-9840-00IBM DB2 10 for z/OS Administration Guide, SC19-2968-00®© Copyright IBM Corporation 2011IBM United States of AmericaProduced in the United States of AmericaAll Rights ReservedThe e-business logo, the eServer logo, IBM, the IBM logo,OS/390, zSeries, SecureWay, S/390, Tivoli, DB2, Lotus and WebSphere are trademarks of International Business Machines Corporation in the United States, other countries or both.Lotus, Lotus Discovery Server, Lotus QuickPlace, Lotus Notes, Domino, and Sametime are trademarks of Lotus Development Corporation and/or IBM Corporation.Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries or both.Other company, product and service names may be trademarks or service marks of others.INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS PAPER “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this statement may not apply to you. Information in this paper as to the availability of products (including portlets) was believed accurate as of the time of publication. IBM cannot guarantee that identified products (including portlets) will continue to be made available by their suppliers.This information could include technical inaccuracies or typographical errors. Changes may be made periodically to the information herein; these changes may be incorporated in subsequent versions of the paper. IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this paper at any time without notice. Any references in this document to non-IBM Web sites are provided for convenience only and do not in any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the materials for this IBM product and use of those Web sites is at your own risk.IBM may have patents or pending patent applications covering subject matter described in this document. The furnishing of this document does not give you any license to these patents. You can send license inquiries, in writing, to:IBM Director of LicensingIBM Corporation4205 South Miami BoulevardResearch Triangle Park, NC 27709 U.S.A.。
db2日常维护
本文主要介绍数据库管理员(DBA)在日常维护中如何形成自己的维护规范,一个完整的日常维护规范可以帮助DBA 理顺每天需要的操作,以便更好的监控和维护数据库,保证数据库的正常、安全、高效运行,防止一些错误重复发生。
“ DB2 日常维护指南, 第1 部分”具体包括检查管理服务器(DAS)是否启动、检查DB2 实例是否启动、查看表空间的状态是否正常、检查表的状态是否正常、查看磁盘空间是否有异常、查看存储管理软件、数据库备份、日志归档是否正常等。
通过明确日常中的每一天该做什么,形成完善的日常管理维护规范,从而更好对数据库进行维护。
检查管理服务器是否启动DB2 管理服务器(DAS )是用于辅助DB2 实例上任务的一个控制点,如果想使用DB2 提供的图形化工具(如“控制中心”、“配置顾问程序”等)、工具目录数据库(ToolsCatalog )、数据库发现等功能,则必须有一个正在运行的DAS 。
DAS 主要有以下功能:1.企业DB2 数据库实例的远程管理。
2.提供用于作业管理的工具,包括调度DB2 数据库管理器和操作系统命令脚本运行的能力,这些命令脚本是用户定义的。
3.使用“任务中心”来对DAS 的远程或本地做到定义作业的安排,查看已完成作业的结果以及执行其他管理任务。
4.与DB2 发现实用程序一起提供一种查找关于DB2 实例、数据库以及其他DB2 管理服务器配置信息的方法。
“配置助手”和“控制中心”使用此信息来简化和自动执行客户机与DB2 数据库的连接配置。
一个数据库物理服务器包括一个管理服务器(Admin Server )以及一个或多个实例,每个实例( 数据库管理器database manager) 是一个逻辑服务器,可以拥有一个到多个数据库。
每个数据库服务器有且只能有一个DAS ,如果没有DAS ,需要发出dascrt 命令(这个命令只是在UNIX 平台有效,在Windows 平台需要使用“ db2admin create ”命令)或者db2admin create 命令(在windows 和UNIX 平台都可以使用)来创建一个DAS 。
数据库日常维护手册
数据库日常维护手册注,蓝色部分为可执行命令,红色部分为重点注意的。
一、停止、启动群集首先应停止实例和相关服务,最后才是关闭节点应用程序(虚拟 IP、GSD、TNS 监听器和ONS)。
以下命令在oracle用户下执行。
emctl stop dbconsolesrvctl stop instance -d hsdb -i hsdb1srvctl stop instance -d hsdb -i hsdb2srvctl stop nodeapps -n bjhsdb1srvctl stop nodeapps –n bjhsdb2启动节点应用程序(虚拟 IP、GSD、TNS 监听器和 ONS)。
当成功启动节点应用程序后,最后才是启动 Oracle 实例和相关服务,以及企业管理器数据库控制台srvctl start nodeapps -n bjhsdb1srvctl start nodeapps -n bjhsdb2srvctl start instance -d hsdb -i hsdb1srvctl start instance -d hsdb -i hsdb2emctl start dbconsole使用 SRVCTL 启动/停止所有实例srvctl start database -d hsdbsrvctl stop database -d hsdb二、归档管理以下命令是在登入数据库主机后,在sqlplus下执行。
查看是否归档Archive log list在RAC中,归档模式之间的切换要比单机复杂,下面是非归档模式该为归档模式保留一个实例tdb1,停掉其它实例(shutdown immediate)以下操作都在mesoradb1执行:alter system set parameter CLUSTER_DATABASE= false scope=spfile;shutdown immediate检查LOG_ARCHIVE_DEST、LOG_ARCHIVE_FORMAT参数是否设定正确,具体参照reference; startup mount若由非归档模式改为归档模式:alter database archivelog由归档模式改为非归档模式:alter database noarchivelogalter database openalter system set parameter CLUSTER_DATABASE= true scope=spfile;shutdown immediate三、空间管理以下命令可在PL/SQL Developer下执行。
某工商局DB2Q复制配置维护手册范本
1、Q复制规划1.1主机和DB2的相关设置信息logging模式(归档日志模式)1.2Websphere MQ的相关配置信息1.3Q复制的配置信息1.4复制队列映射属性1.5通道测试cd /usr/mqm/samp/bin./amqsput SYSA.SENDQ QMSYSA./amqsget SYSB.RECVQ QMSYSB2、mq用户创建创建用户mqm和组mqm,并把组mqm加入到用户db2inst1和db2fenc1中。
3、mq software install解压缩mq软件,用smitty installp安装,创建大小50G的mqmvg 、mqmlv和文件系统mqm,挂载点/var/mqm,/var/mqm/log4、mq 队列和通道创建在dbsvr04上执行setclock dbsvr01进行与dbsvr01的时间同步,需要在/etc/hosts中添加dbsvr01和IP。
由于MQ的需要在dbsvr01和dbsvr04中/etc/hosts添加相互的IP和name 信息。
Service ip 和 service name 也要添加。
Dbsvr04:/etc/hosts:10.0.1.41 dbsvr0110.0.1.44 dbsvr0410.0.1.45 dbserver //hacmp 中service IPMQ测试:Dbsvr01:$ crtmqm -q venus.queue.managerWebSphere MQ queue manager created.Creating or replacing default objects for venus.queue.manager.Default objects statistics : 58 created. 0 replaced. 0 failed. Completing setup.Setup completed.$ strmqmWebSphere MQ queue manager 'venus.queue.manager' starting.5 log records accessed on queue manager 'venus.queue.manager' during the log replay phase.Log replay for queue manager 'venus.queue.manager' complete. Transaction manager state recovered for queue manager 'venus.queue.manager'.WebSphere MQ queue manager 'venus.queue.manager' started.$ runmqsc5724-H72 (C) Copyright IBM Corp. 1994, 2008. ALL RIGHTS RESERVED. Starting MQSC for queue manager venus.queue.manager.define qlocal (orange.queue)1 : define qlocal (orange.queue)AMQ8006: WebSphere MQ queue created.end2 : endOne MQSC command read.No commands have a syntax error.All valid MQSC commands were processed.$ cd /usr/mqm/samp/bin/$ ./amqsput ORANGE.QUEUESample AMQSPUT0 starttarget queue is ORANGE.QUEUEabcddsfsdsdfdsenddbsvr04:$ crtmqm -q venus.queue.managerWebSphere MQ queue manager created.Creating or replacing default objects for venus.queue.manager.Default objects statistics : 58 created. 0 replaced. 0 failed. Completing setup.Setup completed.$ $ strmqmWebSphere MQ queue manager 'venus.queue.manager' starting.5 log records accessed on queue manager 'venus.queue.manager' during the log replay phase.Log replay for queue manager 'venus.queue.manager' complete. Transaction manager state recovered for queue manager'venus.queue.manager'.WebSphere MQ queue manager 'venus.queue.manager' started.$ runmqsc5724-H72 (C) Copyright IBM Corp. 1994, 2008. ALL RIGHTS RESERVED. Starting MQSC for queue manager venus.queue.manager.define qlocal (orange.queue)1 : define qlocal (orange.queue)AMQ8006: WebSphere MQ queue created.:::end2 : endOne MQSC command read.No commands have a syntax error.All valid MQSC commands were processed.$ cd /usr/mqm/samp/bin$ ./amqsput ORANGE.QUEUESample AMQSPUT0 starttarget queue is ORANGE.QUEUEadsfsdfdsfsdfsdfsSample AMQSPUT0 end$$ ./amqsget ORANGE.QUEUESample AMQSGET0 startmessage <adsfsdfdsfsdfsdfs>dbsvr01:crtmqm -lc -d SYSA.XMITQ -u DEADLETTER -lp 20 -ls 10 -lf 10240 QMSYSA //创建MQ队列strmqm QMSYSA //起队列管理器endmqlsr -m QMSYSA //停队列管理器ps -ef | grep mq //查看队列管理器nohup runmqlsr -t tcp -p 1453 -m QMSYSA & //起监听ps –ef|grep lsr // 查看监听进程endmqm QMSYSA //停队列endmqlsr //停监听dltmqm QMSYSA //删除管理队列runmqsc QMSYSA //起MQ资源DEFINE QREMOTE('SYSA.SENDQ') RNAME('SYSB.RECVQ') RQMNAME('QMSYSB') XMITQ('SYSA.XMITQ')DEFINE QLOCAL('SYSA.XMITQ') USAGE(XMITQ) MAXDEPTH(1000000) DEFPSIST(YES)DEFINE QLOCAL('DEADLETTER') USAGE(NORMAL) MAXDEPTH(500000)ALTER QMGR DEADQ('DEADLETTER')DEFINE CHL ('SYSAtoSYSB') CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('10.0.1.44(1454)') XMITQ('SYSA.XMITQ') DISCINT (0) BATCHSZ (200)START CHANNEL ('SYSAtoSYSB')DEFINE CHL ('SYSBtoSYSA') CHLTYPE(RCVR) TRPTYPE(TCP) BATCHSZ(200)DEFINE QLOCAL('SYSA.ADMINQ') MAXDEPTH(500000) DEFPSIST(YES)DEFINE QLOCAL('SYSA.RESTARTQ') MAXDEPTH(500000) DEFPSIST(YES)End*************************runmqsc QMSYSAdis chstatus('SYSAtoSYSB') //显示running 通道状态正常dis chstatus('SYSAtoSYSB')1 : dis chstatus('SYSBtoSYSA')AMQ8417: Display Channel Status details.CHANNEL(SYSBtoSYSA) CHLTYPE(RCVR)CONNAME(10.0.1.44) CURRENTRQMNAME(QMSYSB) STATUS(RUNNING)SUBSTATE(RECEIVE)dis chstatus('SYSBtoSYSA')2 : dis chstatus('SYSBtoSYSA')AMQ8417: Display Channel Status details.CHANNEL(SYSBtoSYSA) CHLTYPE(RCVR)CONNAME(10.0.1.44) CURRENTRQMNAME(QMSYSB) STATUS(RUNNING)SUBSTATE(RECEIVE)*************************runmqsc QMSYSBdis chstatus('SYSBtoSYSA')runmqchl -c SYSAtoSYSB -m QMSYSA //如果没有错误信息显示,表明该channel成功运行runmqchl -c SYSBtoSYSA -m QMSYSA //如果没有错误信息显示,表明该channel 成功运行********************************修改queue manager的CCSID:strmqmrunmqscdisplay qmgr // 检查当前queue manager的CCSID值alter qmgr ccsid(437)end*************************dbsvr04:crtmqm -lc -d SYSB.XMITQ -u DEADLETTER -lp 20 -ls 10 -lf 10240 QMSYSB strmqm QMSYSBnohup runmqlsr -t tcp -p 1454 -m QMSYSB &runmqsc QMSYSBDEFINE QLOCAL('SYSB.RECVQ') MAXDEPTH(1000000) DEFPSIST(YES)DEFINE QREMOTE('SYSA.ADMINQ') RNAME('SYSA.ADMINQ') RQMNAME('QMSYSA') XMITQ('SYSB.XMITQ')DEFINE QLOCAL('SYSB.XMITQ') MAXDEPTH(1000000) USAGE(XMITQ) DEFPSIST(YES)DEFINE QLOCAL('DEADLETTER') USAGE(NORMAL) MAXDEPTH(500000)ALTER QMGR DEADQ('DEADLETTER')DEFINE CHL ('SYSBtoSYSA') CHLTYPE(SDR) TRPTYPE(TCP) CONNAME('10.0.1.45(1453)') XMITQ('SYSB.XMITQ') DISCINT (0) BATCHSZ (200)START CHANNEL ('SYSBtoSYSA')DEFINE CHL ('SYSAtoSYSB') CHLTYPE(RCVR) TRPTYPE(TCP) BATCHSZ(200)DEFINE QMODEL('IBMQREP.SPILL.MODELQ') DEFSOPT(SHARED) MAXDEPTH(1000000) MSGDLVSQ(FIFO) DEFTYPE(PERMDYN)end****************************nohup runmqlsr -t tcp -p 1454 -m QMSYSB & //起监听runmqsc QMSYSBdis chstatus('SYSBtoSYSA') //显示running 通道状态正常dis chstatus('SYSBtoSYSA')dis chstatus('SYSAtoSYSB')1 : dis chstatus('SYSAtoSYSB')AMQ8417: Display Channel Status details.CHANNEL(SYSAtoSYSB) CHLTYPE(RCVR)CONNAME(10.0.1.45) CURRENTRQMNAME(QMSYSA) STATUS(RUNNING)SUBSTATE(RECEIVE)dis chstatus('SYSBtoSYSA')2 : dis chstatus('SYSBtoSYSA')AMQ8417: Display Channel Status details.CHANNEL(SYSBtoSYSA) CHLTYPE(SDR)CONNAME(10.0.1.45(1453)) CURRENTRQMNAME(QMSYSA) STATUS(RUNNING)SUBSTATE(MQGET) XMITQ(SYSB.XMITQ)EN)*********************************************修改队列管理器中的字符集命令:首先打开命令行窗口。
db2日志维护
db2⽇志维护1、查看数据库配置get db cfg for hdxtdb 查看数据库参数db2 => get db cfg for hdxtdbDatabase Configuration for Database hdxtdb数据库 hdxtdb的数据库配置Database configuration release level数据库配置发⾏版级别= 0x0a00Database release level 数据库发⾏版级别 = 0x0a00Database territory 数据库地域 = cnDatabase code page 数据库代码页 = 1386Database code set 数据库代码集 = gbkDatabase country/region code 数据库国家/地区代码 = 86Database collating sequence 数据库整理顺序 = UNIQUEAlternate collating sequence (ALT_COLLATE) =备⽤整理顺序Dynamic SQL Query management (DYN_QUERY_MGMT) = DISABLE动态 SQL 查询管理Discovery support for this database (DISCOVER_DB) = ENABLE对此数据库的发现⽀持 (DISCOVER_DB)Default query optimization class (DFT_QUERYOPT) = 5缺省查询优化类 (DFT_QUERYOPT)Degree of parallelism 并⾏度 (DFT_DEGREE) = 1Continue upon arithmetic exceptions (DFT_SQLMATHWARN) = NO 在算术异常时继续 Default refresh age (DFT_REFRESH_AGE) = 0 缺省刷新有效期Default maintained table types for opt (DFT_MTTB_TYPES) = SYSTEM缺省维护的选项(DFT_MTTB_TYPES)的表类型Number of frequent values retained (NUM_FREQVALUES) = 10保留的⾼频值的数⽬ Number of quantiles retained (NUM_QUANTILES) = 20保留的分位点数⽬Backup pending = NO备份暂挂Database is consistent = NO数据库是⼀致的Rollforward pending = NO前滚暂挂Restore pending = NO复原暂挂Multi-page file allocation enabled = YES启⽤的多页⽂件分配Log retain for recovery status 恢复状态的⽇志保留 = NOUser exit for logging status = NO⽇志记录状态的⽤户出⼝Data Links Token Expiry Interval (sec) (DL_EXPINT) = 60Data Links 标记到期时间间隔(秒)Data Links Write Token Init Expiry Intvl(DL_WT_IEXPINT) = 60Data Links 写标记初始时间间隔Data Links Number of Copies (DL_NUM_COPIES) = 1副本的 Data Links 数⽬Data Links Time after Drop (days) (DL_TIME_DROP) = 1删除后的 Data Links 时间(天数)Data Links Token in Uppercase (DL_UPPER) = NO⼤写的 Data Links 标记Data Links Token Algorithm (DL_TOKEN) = MAC0Data Links 标记算法Database heap (4KB) 数据库堆(4KB (DBHEAP) = 1200Size of database shared memory (4KB) (DATABASE_MEMORY) = AUTOMATIC数据库共享内存⼤⼩(4KB)Catalog cache size (4KB) (CATALOGCACHE_SZ) = (MAXAPPLS*4) ⽬录⾼速缓存⼤⼩(4KB)Log buffer size (4KB) (LOGBUFSZ) = 512⽇志缓冲区⼤⼩(4KB)Utilities heap size (4KB) (UTIL_HEAP_SZ) = 5000实⽤程序堆⼤⼩(4KB)Buffer pool size (pages) (BUFFPAGE) = 1000缓冲池⼤⼩(页)Extended storage segments size (4KB) (ESTORE_SEG_SZ) = 16000扩充存储段⼤⼩(4KB)Number of extended storage segments (NUM_ESTORE_SEGS) = 0扩充存储段的数⽬Max storage for lock list (4KB) (LOCKLIST) = 40960锁定列表的最⼤存储量(4KBMax size of appl. group mem set (4KB) (APPGROUP_MEM_SZ) = 30000应⽤程序组内存集的最⼤⼤⼩(4KB)Percent of mem for appl. group heap (GROUPHEAP_RATIO) = 70应⽤程序组堆的内存百分⽐Max appl. control heap size (4KB) (APP_CTL_HEAP_SZ) = 128最⼤应⽤程序控制堆⼤⼩(4KB)Sort heap thres for shared sorts (4KB) (SHEAPTHRES_SHR) = (SHEAPTHRES) 共享排序的排序堆域值(4KB)Sort list heap (4KB) (SORTHEAP) = 4096排序列表堆(4KB)SQL statement heap (4KB) SQL 语句堆(4KB) (STMTHEAP) = 2048Default application heap (4KB) (APPLHEAPSZ) = 4096缺省应⽤程序堆(4KB)Package cache size (4KB) (PCKCACHESZ) = (MAXAPPLS*8) 程序包⾼速缓存⼤⼩(4KB)Statistics heap size (4KB) (STAT_HEAP_SZ) = 4384统计信息堆⼤⼩(4KB)Interval for checking deadlock (ms) (DLCHKTIME) = 10000检查死锁的时间间隔(毫秒)Percent. of lock lists per application (MAXLOCKS) = 30每个应⽤程序的锁定百分⽐列表Lock timeout (sec) (LOCKTIMEOUT) = 60锁定超时(秒)Changed pages threshold (CHNGPGS_THRESH) = 60更改的页阈值Number of asynchronous page cleaners (NUM_IOCLEANERS) = 2异步页清除程序的数⽬Number of I/O servers (NUM_IOSERVERS) = 7I/O 服务器的数⽬Index sort flag (INDEXSORT) = YES索引排序标志Sequential detect flag (SEQDETECT) = YES顺序检测标志Default prefetch size (pages) (DFT_PREFETCH_SZ) = AUTOMATIC缺省预取⼤⼩(页)Track modified pages (TRACKMOD) = OFF跟踪修改的页数Default number of containers = 1容器的缺省数⽬Default tablespace extentsize (pages) (DFT_EXTENT_SZ) = 32缺省表空间扩展数据块⼤⼩(页)Max number of active applications (MAXAPPLS) = AUTOMATIC 活动应⽤程序的最⼤数⽬Average number of active applications (AVG_APPLS) = 1活动应⽤程序的平均数⽬Max DB files open per application (MAXFILOP) = 64每个应⽤程序的最⼤打开数据库⽂件数Log file size (4KB) (LOGFILSIZ) = 20000⽇志⽂件⼤⼩(4KB)Number of primary log files (LOGPRIMARY) = 30主⽇志⽂件的数⽬Number of secondary log files (LOGSECOND) = 20辅助⽇志⽂件的数⽬Changed path to log files (NEWLOGPATH) =已更改的⾄⽇志⽂件的路径Path to log files ⽇志⽂件路径 = /home/hdxtdb/db2inst1/NODE0000/SQL00001/SQLOGDIR/Overflow log path (OVERFLOWLOGPATH) =溢出⽇志路径Mirror log path (MIRRORLOGPATH) =镜像⽇志路径First active log file =⾸个活动⽇志⽂件Block log on disk full (BLK_LOG_DSK_FUL) = NO磁盘上已满的块⽇志Percent of max active log space by transaction(MAX_LOG) = 0事务使⽤的最⼤活动⽇志空间的百分⽐Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0 1 个活动 UOW 的活动⽇志⽂件的数⽬Group commit count (MINCOMMIT) = 1组落实计数Percent log file reclaimed before soft chckpt (SOFTMAX) = 100软检查点前回收的⽇志⽂件的百分⽐Log retain for recovery enabled (LOGRETAIN) = OFF启⽤的恢复的⽇志保留User exit for logging enabled (USEREXIT) = OFF启⽤的⽇志记录的⽤户出⼝HADR database role = STANDARD HADR 数据库⾓⾊HADR local host name (HADR_LOCAL_HOST) =HADR 本地主机名HADR local service name (HADR_LOCAL_SVC) =HADR 本地服务名称HADR remote host name (HADR_REMOTE_HOST) =HADR 远程主机名HADR remote service name (HADR_REMOTE_SVC) =HADR 远程服务名称HADR instance name of remote server (HADR_REMOTE_INST) =远程服务器的 HADR 实例名HADR timeout value (HADR_TIMEOUT) = 120 HADR 超时值 (HADR_TIMEOUT)HADR log write synchronization mode (HADR_SYNCMODE) = NEARSYNC HADR ⽇志写同步⽅式 (HADR_SYNCMODE) First log archive method (LOGARCHMETH1) = OFF第⼀个⽇志归档⽅法Options for logarchmeth1 (LOGARCHOPT1) = logarchmeth1 的选项Second log archive method (LOGARCHMETH2) = OFF第⼆个⽇志归档⽅法Options for logarchmeth2 (LOGARCHOPT2) = Logarchmeth2 的选项Failover log archive path (FAILARCHPATH) =故障转移⽇志归档路径Number of log archive retries on error (NUMARCHRETRY) = 5错误时重试⽇志归档次数Log archive retry Delay (secs) (ARCHRETRYDELAY) = 20⽇志归档重试延迟(秒)Vendor options (VENDOROPT) =供应商选项 (VENDOROPT)Auto restart enabled (AUTORESTART) = ON启⽤的⾃动重新启动Index re-creation time and redo index build (INDEXREC) = SYSTEM (RESTART) 索引重新创建时间和重做索引构建Log pages during index build (LOGINDEXBUILD) = OFF在索引构建期间记录页Default number of loadrec sessions (DFT_LOADREC_SES) = 1loadrec 会话的缺省数⽬Number of database backups to retain (NUM_DB_BACKUPS) = 12要保留的数据库备份的数⽬Recovery history retention (days) (REC_HIS_RETENTN) = 366恢复历史保留时间(天数)TSM management class TSM 管理类 (TSM_MGMTCLASS) =TSM node name TSM 节点名 (TSM_NODENAME) =TSM owner TSM 所有者 (TSM_OWNER) =TSM password TSM 密码 (TSM_PASSWORD) =Automatic maintenance ⾃动维护 (AUTO_MAINT) = OFFAutomatic database backup (AUTO_DB_BACKUP) = OFF⾃动数据库备份Automatic table maintenance (AUTO_TBL_MAINT) = OFF⾃动表维护Automatic runstats (AUTO_RUNSTATS) = OFF⾃动 runstatsAutomatic statistics profiling (AUTO_STATS_PROF) = OFF⾃动统计信息概要分析Automatic profile updates (AUTO_PROF_UPD) = OFF⾃动概要⽂件更新Automatic reorganization (AUTO_REORG) = OFF⾃动重组db2 =>修改对应的参数,使⽤命令:update db cfg [fordbname] using <参数名> <参数值>db2 => update db cfg using logretain onDB20000I UPDATE DATABASE CONFIGURATION命令成功完成。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
db2tbst <tablespace state> 可以查看编号所代表的状态
db2tbst 命令接收十六进制的状态值,并返回相应的表空间状态。例如,命令 db2tbst 0x0008 返回 State = Load Pending
。而该十六进制的状态值反过来又是 LIST TABLESPACES
查询表中的数据:db2 “select * from mbl_device fetch first 1 rows only”
1.2 检查DB2实例是否已经启动
用ps命令查看是否有db2sysc后台进程
#ps -ef | db2sysc
也可以以DB2实例所有者登录,通过发出db2start命令来确保启动了实例(如果实例已经启动,则会告知SQL1026N
#db2 list tables | grep MBL_ME
Ø 查看MBL_MESSAGE表结构:
#db2 discribe table MBL_MESSAGE
Ø 显示表中所有数据:
#db2 "select * from MBL_MESSAGE"
Ø 显示MBL_MESSAGELOG表中前n行数据内容:
1.7 数据库备份与恢复操作
1.备份方式
集团业务接入平台业务系统已经上线运行两年多,数据量12GB左右,数据库容器总大小15GB,数据库使用档案日志记录,可以进行在线备份。
目前采用在线全量备份的方式来备份整个数据库,在发生灾难性故障时,使用备份文件和日志文件可以进行时间点恢复,将数据库恢复到故障发生的前一刻。
然后 db2 list tables
然后 db2”select count(*) from mb1_device”
然后 db2set db2codepage=1386
1.8 检查归档日志相关操作
请确保活动日志目录下没有的日志文件都已经正确归档到了带机上(查看TSM或第三方存储管理软件)。
Clusvcadm –r <服务名> -m <成员名>
进行数据库的RESTORE恢复(如果出现SQL0322N错误,则修改DB2CODEPAGE参数,然后重新执行restore命令):
主服务器db1: db2 restore db ddn from /home/db2inst/ddnback taken at <备份文件时间戳> to
检查备用数据库服务器数据库运行是否正常:
备用服务器:db2 connnect to db2
Db2 list tables
Db2 “select count(*) from mb1_device”
用集群管理工具将数据库服务切换到备用DB服务器:
(4) 检查备份文件是否tar到磁带
通过 tar -tvf /dev/st0 命令查看磁带的内容,确认显示结果中有最新的备份文件。当磁带中的备份文件较多时,这个操作可能花费很长时间。
检查备份配置文件情况:
【db2inst@db1 ~】$ crontab -l
备份文件存放目录:
【db2inst@db1 ~】$ cd db2exec/bin
用ps命令查看是否有db2sysc后台进程
#ps -ef | db2sysc
Ø 检查数据库服务器是否可以通过网络访问
相关命令:ping 10.7.63.202
telnet 10.7.63.202 60000
db2 connect to ddn user db2inst (使用db2inst用户)
集群中有两个服务,数据库和FTP。数据库服务包括VIP、文件系统、db2run脚本三个资源。这些可以查看集群配置文件
/etc/cluster/cluster.conf。
在图形界面下,使用system-config-cluster启动集群管理工具。在命令行下,使用clustat命令可以查看集群状态;使用clusvcadm命令可以启动、切换服务。
2.备份策略
目前,数据库每天凌晨两点进行一次全量备份,备份文件存放在本地硬盘,保留最近两天的备份。备份完成后,将备份文件传送到磁带机,保留最近50天的备份。这样既保证数据库备份文件异地存放,又实现了充分冗余。
3.备份的实现
数据库的定期自动备份是通过操作系统cron程序定期执行备份脚本db2mbk-master来实现的。该脚本包括如下功能:
(1) 在线全备ddn数据库。
(2) 将备份文件tar到磁带中。
(3) 删除两天以上的旧备份文件。
(4) 将每项操作的时间、结果记录到备份日志中。
(5) 自动清理备份日志。
4.备份的检查
检查数据库的备份情况需要在服务器上进行,包括以下内容:
(1) 检查备份文件是否生成
挂载文件系统:mount /dev/sdb1 /mnt/data
启动数据库:su - db2inst
db2start
(3) 检查数据库状态
在WEB服务器上以db2inst用户执行如下命令:
连接数据库:db2 connect to ddn user db2inst 命令
DB2数据库日常维护手册(示例)
1.1 检查管理相关服务
RHCS的包括4个服务,按照启动顺序依次是:ccsd、cman、fenced、rgmanager。可以使用service命令启停这些服务或查看状态。(service
service_name start/stop/status)
备份文件存放在 /home/db2inst/db2backup/backup
目录下,文件名称类似DDN.0.db2inst.NODE0000.CATN0000.20091109164735.001,正常情况下该目录下应该有最近两天生成的两个备份文件。
(2) 检查备份过程是否正常
备份日志存放在 /home/db2inst/db2exec/log
mbl_messagelog_1127"
删除mbl_messagelog_1127表及包含的数据
db2 drop table mbl_messagelog_1127
1.5 查看磁盘空间
#df -h
1.6 检查配置文件信息
su – db2inst
db2 connect to ddn
命令输出的组成部分。表空间的外部可见状态是由单个状态值的十六进制总和构成的。例如,如果表空间的状态是 Backup Pending和 Load in
Progress,那么所返回的十六进制值就是 0x20020(0x00020 + 0x20000)
1.4 与表有关操作
Ø 显示与MBL_ME匹配的所有表:
Ø 平台服务器重启后需要启动的服务汇总如下:
web1、2服务器:
service tomcat start 启动tomcat服务
service turbomq start 启动turbomq服务
/usr/local/GETGPSMaile/run.sh 启动获取里程数服务
可以使用LIST TABLESPACES 命令确定连接数据库中表空间的当前状态,可以使用SHOW
DETAIL选项查看表空间的详细信息。比如,我们连上SAMPLE数据库,执行list tablespaces show detail
,可以看到状态返回值是0x0000,此时,使用db2tbst可以查看状态编号对于的状态含义,具体语法如下:
数据库管理器已激活;否则,将把实例启动起来)
1.3 查看表空间状态是否正常
以db2实例所有者登录
#db2 conn to ddn
#db2 list tablespaces show detail //在单分区上查看表空间的状态,正常返回0x0000
# db2_all list tablespaces show detail //在所有分区上查看表空间的状态
显示DB2配置文件中与数据库ddn有关所有信息:
【db2inst@db1 ~】db2 get db cfg for ddn show detail|more
查看DB2配置文件,过滤出log的配置信息:
【db2inst@db1 ~】db2 get db cfg for ddn show detail | grep -i log
/mnt/data 例如:db2set db2codepage=819
进行数据库的ROLLFORWARD恢复:
主服务器db1: db2 rollforward db ddn to end of logs and stop
测试数据库状态:
主服务器: db2 connect to db2
检查VIP是否已经解除绑定(ifconfig),如未解绑以root用户执行 ifconfig eth0:1 down 命令。
如果部分资源无法卸载,考虑在适当时候重启故障服务器。
(2) 在可用节点上挂载资源
登陆状态正常的服务器,以root用户执行如下命令:
绑定VIP:ifconfig eth0:1 10.7.63.202 netmask 255.255.255.128 up
可用ps -ef | grep java进行查看是否彻底关闭
lvs服务器无需单独启服务,随开机即可启动相关服务
Ø 手动挂载相关资源操作
如果RHCS集群出现异常,无法启动或切换数据库服务,可以通过手工方式挂载相关资源。但此时这些资源已经脱离集群软件的管理,集群状态恢复正常后,应同样通过手工方式卸载这源自资源,再使用集群管理工具启动服务。