资源描述
单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,可编辑课件PPT,*,*,单击此处编辑母版标题样式,可编辑课件PPT,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,单击此处编辑母版标题样式,单击此处编辑母版文本样式,二级,三级,四级,五级,*,DB2知识讲座,1,可编辑课件PPT,培训内容,Adding database partitions,Redistributing partition groups,Altering database partitions,Dropping a database partitions,2,可编辑课件PPT,Services file,During the instance creation,a number of ports,which are equal to the number of logical nodes that the instance is capable of supporting,are reserved in the services file.,The ports that are reserved in the services file are used by the DB2 Fast Communication Manager.The reserved ports have the following format:,Cat/etc/services|grep db2,/etc/services with for ports reserved for db2inst1,DB2_InstanceName 端口号,DB2_InstanceName_1,端口号,DB2_InstanceName_2,端口号,DB2_InstanceName_END,端口号,The only mandatory entries are the beginning(DB2_InstanceName)and ending(DB2_InstanceName_END)ports.The other entries are reserved in the services so that other applications do not use these ports,3,可编辑课件PPT,rootdb2One:su db2inst1,db2inst1db2One:db2start,db2inst1db2One:db2 connect to itsodb,db2inst1db2One:db2“create table student(id integer not null primary key,name varchar(2)not null)distribute by hash(id)in userspace01”,Note:(如果未指定主键且未定义分布键,那么分布键是该列表中的第一个非长型列),db2inst1db2One:db2 “select dbpartitionnum(id),count(*)from db2inst1.student group by dbpartitionnum(id)order by dbpartitionnum(id)(查看数据分布情况),4,可编辑课件PPT,Database partitions can be added to a DPF environment by using the following commands,:,db2start.ADD DBPARTITIONNUM,ADD DBPARTITIONNUM,The db2start.ADD DBPARTITIONNUM command starts DB2 and adds a new partition to an existing instance and database.,db2inst1db2Two:,db2start DBPARTITIONNUM 4 ADD DBPARTITIONNUM HOSTNAME db2Two PORT 2 without tablespaces(可选,建议有),04/04/2007 09:00:16 4 0 SQL6075W The Start Database Manager,operation successfully added the node.The node is not active until all nodes are stopped and started again.,SQL6075W The Start Database Manager operation successfully added the node.The node is not active until all nodes are stopped and started again.,注意:那台机器增加数据库分区就登陆到那台机器上发布命令,5,可编辑课件PPT,Upon successful completion of the command,the new db2nodes.cfg is as shown,The db2nodes.cfg after successfully adding a databaspartition,0 db2One 0,1 db2One 1,2 db2Two 0,3 db2Two 1,4 db2Two 2,Note:也可以先更改,db2nodes.cfg,.把要增加的分区填进去,db2inst1db2Two:db2start dbparitionnum n,db2inst1db2Two:add dbpartitionnum without tablespaces,6,可编辑课件PPT,7,可编辑课件PPT,Add tablespaces,db2inst1db2Two:,db2 alter,tablespace,tempspace01 add,(/db2temp/db2inst1/itsodb/NODE0004/tempspace01)on,dbpartitionnum,(4)“,db2inst1db2Two:,db2 alter database partition group,IBMDEFAULTGROUP,add dbpartitionnum(4)without,tablespaces,“,db2inst1db2Two:,db2,alter,tablespace,userspace01 add,(file/tablespaces/db2inst1/itsodb/NODE0004/userspace01.001 20M)on,dbpartitionnum,(4),DB20000I The SQL command completed successful,表在 ibmcatagroup和ibmtempgroup的不能被从新发布。,redistribute 命令只能在目录分区执行,8,可编辑课件PPT,db2inst1db2Two:export DB2NODE=0(switching partitions),db2inst1db2Two:db2 terminate(终止db2后台进程使其有效),db2inst1db2Two:db2 connect to itsodb,db2inst1db2Two:db2“values(current dbpartitionnum)”(查看是否在0 这个分区上),db2inst1db2Two:db2“redistribute database partition group IBMDEFAULTGROUP uniform”(从新发布下数据),db2inst1udb2Two:db2 “select dbpartitionnum(id),count(*)from db2inst1.student group by dbpartitionnum(id)order by dbpartitionnum(id)(查看数据分布情况),9,可编辑课件PPT,db2inst1db2Two:,export DB2NODE=4,db2inst1db2Two:,db2,terminate,db2inst1db2Two:,db2 drop,dbpartitionum,verify(,验证是否含有数据,如如有需要从新发布,),db2inst1db2Two:,export DB2NODE=0,db2inst1db2Two:,db2 terminate,db2inst1db2Two:,db2 connect to,itsodb,db2inst1db2Two:,db2 alter database partition group IBMDEFAULGROUP drop dbpartitionnum(4)“,db2inst1,db2Two,:,db2“redistribute database partition group,IBMDEFAULTGROUP,uniform”,db2inst1,db2Two,:,export,export,=4,db2inst1,db2Two,:,db2 terminate,db2inst1,db2Two,:,db2 drop,dbpartitionum,verify,db2inst1,db2Two,:,db2stop drop,dbpartitionnum,4,10,可编辑课件PPT,Thank a million,11,可编辑课件PPT,12,可编辑课件PPT,13,可编辑课件PPT,此课件下载可自行编辑修改,此课件供参考!,部分内容来源于网络,如有侵权请与我联系删除!感谢你的观看!,
展开阅读全文