rah: to send to all physical servers db2_all: to send to all database partitions: db2_all '<<+1< command':send command to only database partition 1: db2_all '<<-1< command':send command to all database partition except 1: db2_all '||command':to execute command simultaneously across all database partitions:
下面是具体的操作测试:
db2_all "db2 "select count(*) from scheam.test"" 这个命令相当于在每个节点上执行一次
hostnameA:/db2home/db2inst1#db2_all "db2 "select count(*) from scheam.test""
1 ----------- 616526521
1 record(s) selected.
hostnameA_svc: db2 "select count(*) ... completed ok
1 ----------- 616526521
1 record(s) selected.
hostnameA_svc: db2 "select count(*) ... completed ok 剩余节点输出类似
hostnameA:/db2home/db2inst1#db2_all "<<+1< db2 "select count(*) from scheam.test ""
1 ----------- 616526521
1 record(s) selected.
hostnameA_svc: db2 "select count(*) ... completed ok
hostnameA:/db2home/db2inst1#db2_all "<<+1< db2 "select count(*) from scheam.test where dbpartitionnum(user_id)=current dbpartitionnum""
1 ----------- 19268363
1 record(s) selected.
hostnameA_svc: db2 "select count(*) ... completed ok
hostnameA:/db2home/db2inst1#db2_all "<<-1< db2 "select count(*) from scheam.test where dbpartitionnum(user_id)=current dbpartitionnum""
添加新评论4 条评论
2014-08-19 22:05
db2set DB2DBDFT=dbname
2014-06-24 22:02
能够直接执行吗?
怎么在我的环境中只能先连库再执行?而且()必须转义
db2_all "d
db2set DB2DBDFT=dbname
2014-06-24 15:27
能够直接执行吗?
怎么在我的环境中只能先连库再执行?而且()必须转义
db2_all "db2 connect to dbname;db2 select count(*) from scheam.test"
2014-06-13 15:43