KingbaseES数据库常见问题(持续更新)
currentSchema=schenam_name 修改为jdbc.master.url=jdbc:kingbase8://xxx.xxx.xxx.xxx:54321/db1。/data/kingbase/data/kingbase.conf 里面找到dynamic_shared_memory_type参数,改为dynamic_shared_memory_type = sysv。
目录
1.KingbaseES sqlserver 模式迁移SQLServer 模式提示“cannot insert multiple commands into a prepared statement”
2.sys_backup.sh init时提示can not connect the primary node
3.设置逻辑备份运行脚本时提示错误are not allowed to use this program (crontab)
6.部署KFS时提示“ Unable to find any host conigurations for the data senice speced”
7.本地虚拟环境KES V8R6集群物理备份初始化时提示more than one primary cluster found
8.com.kingbase8.util.KSQLException: An I/O error occurred while sending to the backend.
12.ksql test/kingbase system 登录后无权限建库,建表“can not create database in current database”
14.空间地理信息库,报错“ Can't infer the s0L type to use for an instance of org.postgis.PGgeometry”
15.sys_dump导出提示“ error: could not parse default ACL list ”
16.物理备份初始化提示“must located in local”
17.mysql 模式下查询横线的模式或表提示"SOL错淏[426011: ERROR: svntax error at or near "gz-papb" "
1.KingbaseES sqlserver 模式迁移SQLServer 模式提示“cannot insert multiple commands into a prepared statement”
在kes中执行以下语句
alter user xxx set enable_automatic_block to on;
2.sys_backup.sh init时提示can not connect the primary node
# pre-condition: check the non-archived WAL files
ERROR: can not connect the primary node 192.168.56.112 by ksql
HINT: may use sys_encpwd to setup .encpwd
*****注意配置中的_single_bin_dir 参数是Server/bin
3.设置逻辑备份运行脚本时提示错误are not allowed to use this program (crontab)
情景1:HiSilicon Kunpeng-920 / ky10
/etc/cron.allow 文件添加kingbase用户后依然提示报错。
问题:
[kingbase@kylinv10sp1 R6logic_backup-final]$ crontab -l
You (kingbase) are not allowed to use this program (crontab)
See crontab(1) for more information
--注意权限,检查/usr/bin/crontab是否有特权
[root@kylinv10sp1 bin]# ls -al crontab
-rwxr-xr-x 1 root root 68248 Apr 1 2020 crontab
[root@kylinv10sp1 bin]# chmod u+s /usr/bin/crontab
[root@kylinv10sp1 bin]# ls -al crontab
-rwsr-xr-x 1 root root 68248 Apr 1 2020 crontab
[root@kylinv10sp1 bin]# su - kingbase
Last login: Wed Feb 21 11:41:48 CST 2024 on pts/3
[kingbase@kylinv10sp1 ~]$ crontab -l
no crontab for kingbase
情景2:统信操作系统,先给777权限,再给s权限
[root@localhost insatll]# chmod 777 /usr/bin/crontab
[root@localhost insatll]# chmod u+s /usr/bin/crontab
[root@localhost insatll]# ls -rtl /usr/bin/crontab
-rwsrwxrwx 1 root root 63160 3月 14 05:47 /usr/bin/crontab
4.修改表字段类型bit为int失败,提示SQL 错误[42804]: ERROR: default for column "prescript" cannot be cast automaticallyto type integer
原bit字段有一个默认值,导致修改失败,先取消默认值,再执行修改字段即可。
ALTER TABLE tc_geo_address_catalog
ALTER COLUMN prescript
SET DEFAULT NULL;
alter table tc_geo_address_catalog alter column prescript type int using id ::int;
5.string_agg和group_concat函数
pg模式用string_agg(),oracle模式用group_concat(),注意参数为text,若传入的参数类型不正确,则会报错。
重写:
CREATE OR REPLACE FUNCTION F_CONCAT(TEXT,TEXT,TEXT) RETURNS TEXT AS
$$
SELECT $1||$3||$2;
$$ LANGUAGE SQL STRICT;
CREATE AGGREGATE group_concat(TEXT,TEXT)(SFUNC=F_CONCAT,STYPE=TEXT);
6.部署KFS时提示“ Unable to find any host conigurations for the data senice speced”
检查配置文件中的ip 是否正确,特别时使用代理的服务器,登录IP并部署真实IP。
7.本地虚拟环境KES V8R6集群物理备份初始化时提示more than one primary cluster found

经排查,本地测试服务器是采用nat+host-only模式,且虚拟机时复制的方式,nat网卡的mac地址和ip都没有变化,修改或者删除网卡信息后,执行初始化脚本成功。
8.com.kingbase8.util.KSQLException: An I/O error occurred while sending to the backend.
show tcp_keepalives_idle; 修改为tcp_keepalives_idle = 60
9.could not open shared memory segment "/kingbase.1416331144": No such file or directory (SQLSTATE 5
/data/kingbase/data/kingbase.conf 里面找到dynamic_shared_memory_type 参数,改为dynamic_shared_memory_type = sysv
重启数据库
10.海光+方德环境安装时提示“Exception in thread"main" java.lang.UnsupportedclassVersionError: com/zerog/lax/LAX : Unsupported major .minor version 52.0

通过Unsupported major.minor version 52.0信息基本可以确定是由于JDK版本不匹配导致的安装报错,根据错误信息52得知,要求的JDK对应版本号码为52.52对应JDK 1.8版本(Unsupported major.minor version 52.0信息为要求JDK对应的版本,而不是报错的JDK版本).高于52的jdk都可以使用。
11.业务表与系统表冲突时,修改search_path
当 Kingbase 数据库中的业务表与系统表发生名称冲突时,可以通过修改 search_path 来解决这个问题。进入到对应的库,执行
alter database dbname set search_path=schema_name,'$user',public,sys,sys_catalog,pg_catalog; ---必须加上sys,sys_catalog,pg_catalog
select sys_reload_conf();
重连客户端,重启应用后生效,若应用重启后依然没有生效,则检查jdbc url ,url 里不再需要配置Currentschema 参数,因为带模式名时忽略search_path。
jdbc.master.url=jdbc:kingbase8://xxx.xxx.xxx.xxx:54321/db1?currentSchema=schenam_name 修改为jdbc.master.url=jdbc:kingbase8://xxx.xxx.xxx.xxx:54321/db1
或者修改应用URL中的search_path,类似:jdbc:kingbase8://xxx.xxx.xxx.xxx:54321/test?currentSchema='$user',public,sys,sys_catalog,pg_catalog&useUnicode=true&tcpKeepAlive=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&reWriteBatchedlnserts=true
12.ksql test/kingbase system 登录后无权限建库,建表“can not create database in current database”


该金仓库兼容模式为SQLSERVER, 单兼容模式为sqlserver 时,需要登录master 库进行建库,手动新建模式后,再进行建表;
13.迁移GIS数据提示append_sridb标识符无效
![]()
gis数据中的srid拼接到gis数据中以前查询出来。在源端数据库中创建以下函数:
-- 创建函数
CREATE OR REPLACE FUNCTION append_srid(srid IN INTEGER,kwb IN blob) RETURN blob AS
re blob;
srid_ integer;
BEGIN
IF kwb IS NULL then
RETURN NULL;
END IF;
re := to_blob(UTL_RAW.cast_from_binary_integer(srid,utl_raw.little_endian));
dbms_lob.append(re,kwb);
RETURN re;
END;
-- 赋权
GRANT EXECUTE ON my_schema.append_sridTO ueser_xxx;
14.空间地理信息库,报错“ Can't infer the s0L type to use for an instance of org.postgis.PGgeometry”
用数据安装目录复制出来的 postgresql-42.2.9.jar 写入数据库正常,用 kingbase8-8.6.0.jar 报错

15.sys_dump导出提示“ error: could not parse default ACL list ”
环境:
cpu:Kunpeng-920
操作系统:UnionTech OS Server 20
版本:V008R006C008M001B0025
模式:mysql
[kingbase@0002 ~]$ sys_dump -Usystem -dcasdb2 -n statistics_data -Fc -f /home1/kingbase/temp/statistics_data.dmp
sys_dump: error: could not parse default ACL list ({mhke_dev=rwU/system,user_linlie=r/system})

版本已知问题,需要找技术人员申请补丁包
16.物理备份初始化提示“must located in local”
统信操作系统在做物理备份初始化时提示“ERROR: repo_ip [127.0.0.1] must located in local, and sys_backup.sh be executed at REPO host.”
处理:
[kingbase@iZ0pu01nu7k81z6qmthnd7Z share]$ sys_backup.sh init
ERROR: repo_ip [127.0.0.1] must located in local, and sys_backup.sh be executed at REPO host.
-rwsr-x--- 1 root root 79848 Jun 25 2023 /usr/bin/ping
[root@iZ0pu01nu7k81z6qmthnd7Z install]# chmod 777 /usr/bin/ping
17.mysql 模式下查询横线的模式或表提示"SOL错淏[426011: ERROR: svntax error at or near "gz-papb" "
检查sql_mode 参数是否存在“ANSI_QUOTES” ,不存在该值的话,则无法识别引号。

更多推荐


所有评论(0)