服务器字符集对DM7中List分区表使用中文的影响

1.在Linux平台上使用disql工具创建List分区表sales时对分区键指定英文字符时,当指定多个值时可以创建成功

SQL> CREATE TABLE sales
2   (
3   sales_id INT,
4   saleman CHAR(20),
5   saledate DATETIME,
6   city CHAR(10)
7   )
8   PARTITION BY LIST(city)
9   (
10  PARTITION p1 VALUES ('a','b'),
11  PARTITION p2 VALUES ('c','d','e'),
12  PARTITION p3 VALUES ('f','g'),
13  PARTITION p4 VALUES ('h','i')
14  );
warning: List partition not include default,partition may be not located
executed successfully
used time: 115.412(ms). Execute id is 2094.

2.在Linux平台上使用disql工具创建List分区表sales时对分区键指定中文时,当指定多个列表值时创建报错

SQL> drop table sales;
executed successfully
used time: 307.935(ms). Execute id is 2095.

SQL> CREATE TABLE sales
2   (
3   sales_id INT,
4   saleman CHAR(20),
5   saledate DATETIME,
6   city CHAR(50)
7   )
8   PARTITION BY LIST(city)
9   (
10  PARTITION p1 VALUES ('北京','天津'),
11  PARTITION p2 VALUES ('上海','南京','杭州'),
12  PARTITION p3 VALUES ('武汉','长沙'),
13  PARTITION p4 VALUES ('广州','深圳')
14  );
CREATE TABLE sales
(
sales_id INT,
saleman CHAR(20),
saledate DATETIME,
city CHAR(50)
)
PARTITION BY LIST(city)
(
PARTITION p1 VALUES ('北京','天津'),
PARTITION p2 VALUES ('上海','南京','杭州'),
PARTITION p3 VALUES ('武汉','长沙'),
PARTITION p4 VALUES ('广州','深圳')
);

PARTITION p2 VALUES ('上海','南京','杭州'),
                             *             
line 11, column 30, nearby [藝娴穄 has error[-2007]:
Syntax error.
used time: 0.328(ms). Execute id is 0.

3.在Linux平台上使用disql工具创建List分区表sales时对分区键指定中文时,当指定一个列表值时创建成功

SQL> CREATE TABLE sales
2   (
3   sales_id INT,
4   saleman CHAR(20),
5   saledate DATETIME,
6   city CHAR(10)
7   )
8   PARTITION BY LIST(city)
9   (
10  PARTITION p1 VALUES ('北京'),
11  PARTITION p2 VALUES ('上海'),
12  PARTITION p3 VALUES ('武汉'),
13  PARTITION p4 VALUES ('广州')
14  );
warning: List partition not include default,partition may be not located
executed successfully
used time: 19.809(ms). Execute id is 2096.

4.在win平台使用disql工具创建List分区表sales时对分区键指定中文时,当指定多个列表值时创建成功

disql V7.1.6.48-Build(2018.03.01-89507)ENT
SQL> conn jy/abcd@10.10.10.1:5236

服务器[10.10.10.1:5236]:处于普通打开状态
登录使用时间: 14.001(毫秒)
SQL> drop table sales;
操作已执行
已用时间: 352.729(毫秒). 执行号:2118.
SQL> CREATE TABLE SALES(
2   SALES_ID INT,
3   SALEMAN CHAR(20),
4   SALEDATE DATETIME,
5   CITY CHAR(10)
6   )
7   PARTITION BY LIST(CITY)
8   SUBPARTITION BY RANGE(SALEDATE) SUBPARTITION TEMPLATE(
9   SUBPARTITION P11 VALUES LESS THAN ('2012-04-01'),
10  SUBPARTITION P12 VALUES LESS THAN ('2012-07-01'),
11  SUBPARTITION P13 VALUES LESS THAN ('2012-10-01'),
12  SUBPARTITION P14 VALUES EQU OR LESS THAN (MAXVALUE))
13  (
14  PARTITION P1 VALUES ('北京','天津')
15  (
16  SUBPARTITION P11_1 VALUES LESS THAN ('2012-10-01'),
17  SUBPARTITION P11_2 VALUES EQU OR LESS THAN (MAXVALUE)
18  ),
19  PARTITION P2 VALUES ('上海','南京','杭州'),
20  PARTITION P3 VALUES (DEFAULT)
21  );
操作已执行
已用时间: 26.710(毫秒). 执行号:2119.
SQL>

5.在Linux平台上使用管理工具创建List分区表sales时对分区键指定中文时,当指定多个列表值时创建也能成功

6.查看操作系统字符集为UTF-8

[root@shard1 /]# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

7.修改操作系统字符集

[root@shard1 /]# vi /etc/locale.conf
#LANG="en_US.UTF-8"
LANG="zh_CN.gb2312"

[root@shard1 ~]# locale
LANG=zh_CN.gb2312
LC_CTYPE="zh_CN.gb2312"
LC_NUMERIC="zh_CN.gb2312"
LC_TIME="zh_CN.gb2312"
LC_COLLATE="zh_CN.gb2312"
LC_MONETARY="zh_CN.gb2312"
LC_MESSAGES="zh_CN.gb2312"
LC_PAPER="zh_CN.gb2312"
LC_NAME="zh_CN.gb2312"
LC_ADDRESS="zh_CN.gb2312"
LC_TELEPHONE="zh_CN.gb2312"
LC_MEASUREMENT="zh_CN.gb2312"
LC_IDENTIFICATION="zh_CN.gb2312"
LC_ALL=

8.当修改字符集后在Linux平台使用disql工具创建List分区表sales时对分区键指定中文时,当指定多个列表值时创建成功

[dmdba@shard1 bin]$ ./disql jy/abcd@10.10.10.1:5236

Server[10.10.10.1:5236]:mode is normal, state is open
login used time: 9.677(ms)
disql V7.1.6.46-Build(2018.02.08-89107)ENT 
Connected to: DM 7.1.6.46
SQL> drop table sales;
executed successfully
used time: 351.233(ms). Execute id is 2120.
SQL> CREATE TABLE SALES(
2   SALES_ID INT,
3   SALEMAN CHAR(20),
4   SALEDATE DATETIME,
5   CITY CHAR(10)
6   )
7   PARTITION BY LIST(CITY)
8   SUBPARTITION BY RANGE(SALEDATE) SUBPARTITION TEMPLATE(
9   SUBPARTITION P11 VALUES LESS THAN ('2012-04-01'),
10  SUBPARTITION P12 VALUES LESS THAN ('2012-07-01'),
11  SUBPARTITION P13 VALUES LESS THAN ('2012-10-01'),
12  SUBPARTITION P14 VALUES EQU OR LESS THAN (MAXVALUE))
13  (
14  PARTITION P1 VALUES ('北京','天津')
15  (
16  SUBPARTITION P11_1 VALUES LESS THAN ('2012-10-01'),
17  SUBPARTITION P11_2 VALUES EQU OR LESS THAN (MAXVALUE)
18  ),
19  PARTITION P2 VALUES ('上海','南京','杭州'),
20  PARTITION P3 VALUES (DEFAULT)
21  );
executed successfully
used time: 22.411(ms). Execute id is 2121.

从上面的测试来看,字符集对List分区表使用中文存在影响。

发表评论

电子邮件地址不会被公开。