PARTITIONING KEY(foo) USING HASHING; 这是指定哪个列用于分区数据的方法。请记住:列 foo 中的值应该有高基数(假定没有许多重复值)。
如果您更喜欢用另一种方法来插入行,请随意。该程序将一个递增整数插入列 foo 中。
该步骤中所示的查询显示了行在 4096 个散列存储区之间是如何分布的。随着更多的键值混编到特定存储区,散列存储区不断增大。这表示某些散列存储区的值可以比其它散列存储区多。这是任何散列算法所固有的,不会有负面影响,除非有一个显著的散列偏离。如果发生显著的偏离,您或许要查看分区键的基数并挑选一些值更为独特的东西。
select partition ( foo) as Partition_Hash,
count(*) as Hash_Count
from marty
group by partition ( foo)
order by count(*) desc
fetch first 10 rows only ;
PARTITION_HASH HASH_COUNT
-------------- -----------
2626 17
3464 15
307 13
329 13
746 13
1913 13
107 12
492 12
847 12
1021 12
10 record(s) selected.
祝贺您!享受您的选择吧!如果您到此没有任何错误,我会很激动。如果有错误,我希望下面一节会尽量减少您的烦恼。
疑难解答
万一某一步骤出错,下面是各种错误消息的参考和修正它们所需的步骤。
消息:SQL6031N 错误 症状:
SQL6031N Error in the db2nodes.cfg file at line number "2". Reason code "12".
诊断:
要查找该错误的文本,使用 db2 命令环境 $ db2 ? SQL031N Reason code ?2? states: (12) Ensure that you only use port values that are specified in the services file (/etc/services file on UNIX-based systems) for your instance. 解决方案:
要修正该问题,根据上面 第 6 步的描述更新 /etc/services。 消息:SQL6048N 通信错误
该消息可能出现在启动和停止处理期间,如 第 10 步中所描述的那样。该问题的根源要回到 第 2 步。导致出现该消息的其它可能问题是 pdksh 问题,我们将在 下面讨论它。
症状:
[db2inst1@poohbah db2inst1]$ db2start
12-31-2001 09:29:32 0 0 SQL6048N A communication error occurred during START or STOP DATABASE MANAGER processing.
12-31-2001 09:29:32 1 0 SQL6048N A communication error occurred during START or STOP DATABASE MANAGER processing.
SQL1032N No start database manager command was issued. SQLSTATE=57019
SQL6048N A communication error occurred during START or STOP
DATABASE MANAGER processing.
诊断:
节点无法彼此对话。节点必须通信,才能传输 SQL 查询和接收回结果集。
下面显示了该错误消息的全文:
Explanation: A TCP/IP communication error occurred while the START or STOP DATABASE MANAGER command was trying to establish connection with all the nodes defined in the sqllib/db2nodes.cfg file.
User Response: Do the following:: Ensure that the node has the proper a uthorization defined in the .rhosts or the host.equiv files.
If using multiple logical nodes, ensure the DB2NODE environment variable is set correctly. The DB2NODE environment variable indicates the node the application will attempt to connect to. DB2NODE must be set to the node number of one of the nodes defined on the same host as the application.
解决方案:
在 db2inst 主目录中添加 .rhosts 文件,通过输入下列命令,验证 rsh 是否正在运行:
$ rsh localhost echo hi
文本“hi”将出现在标准输出上。您可以用下列命令进一步验证功能的正确性:
$ db2_all echo hi
应该在标准输出上获得字符串“hi”,db2_all 的成功操作指出您还正确地安装了 pdksh。如果 db2_all 失败,请阅读下一个错误消息。
消息:SQL6048N 症状:
由于 第 2 步中 rsh 设置出现的问题,我们可能已经看到了这一错误消息。如果没有按照 第 4 步所描述的那样安装 pdksh,那么也会出现该错误。
[db2inst1@poohbah db2inst1]$ db2start
12-31-2001 10:21:42 0 0 SQL6048N A communication error occurred during START or STOP DATABASE MANAGER processing.
12-31-2001 10:21:42 1 0 SQL6048N A communication error occurred during START or STOP DATABASE MANAGER processing.
SQL1032N No start database manager command was issued. SQLSTATE=57019
诊断:
这些错误是由于丢失 /bin/ksh 引起的。
解决方案:按照下面的指示信息安装公共域 Korn shell:
rpm -i /mnt/cdrom/RedHat/RPMS/pdksh-5.2.14-13.i386.rpm
消息:SQL0902C 系统错误 症状:
数据库启动,但在连接时发生错误。在 Red Hat 7.1 和 Red Hat 7.2 平台上出现的错误有所不同。
Red Hat Linux 7.2 上的内核参数错误:
[db2inst1@poohbah db2inst1]$ db2start
01-03-2002 10:41:45 1 0 SQL1063N DB2START processing was successful.
01-03-2002 10:41:46 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
[db2inst1@poohbah db
上一篇教程: DB2 UDB V8 中设置用户出口来归档数据库日志
下一篇教程: 创建高可用性的 DB2 服务(一)






