GaussDB的gs_dump工具问题整理,疑似BUG
GaussDB的gs_dump工具问题整理,疑似BUG
目前分布式GaussDB用起来问题感觉巨多啊。
版本信息如下:
09:04:11 root@postgres > select version(); -[ RECORD 1 ]---------------------------------------------------------------------------------------------------------------------- version | gaussdb (GaussDB Kernel 503.1.0.SPC2000 build 15786b02) compiled at 2023-12-12 22:07:15 commit 5868 last mr 14483 release Time: 1.951 ms 09:04:12 root@postgres > select * from v$version; -[ RECORD 1 ]-+-------------------------------------------------------- banner | gaussdb (GaussDB Kernel 503.1.0.SPC2000 build 15786b02) banner_full | gaussdb (GaussDB Kernel 503.1.0.SPC2000 build 15786b02) banner_legacy | gaussdb (GaussDB Kernel 503.1.0.SPC2000 build 15786b02) con_id | 0 Time: 2.081 ms
gs_dump本身功能不多,问题还很多,而且分布式GaussDB到集中式GaussDB使用gs_dump本质上会有少部分语法不兼容需要纯文本格式导出进行编辑。
此版本的分布式GaussDB目前也不支持间隔分区等等等等。。
这里列三个遇到的问题。
问题1:导出库的时候,库中存在包和包体会有warning。
若是纯文本导出测试看,包,包体是有成功导出的,也能够成功导入。
目前不知道有无隐患。是否为BUG。
环境模拟脚本如下:
create database zkmdb owner root encoding 'UTF8' tablespace szceb template = template0 dbcompatibility = 'A'; \c zkmdb create user zkm identified by 'huawei@123Pwd'; set current_schema=zkm; Create Table T_PsnSalary ( Fpsncode varchar(4), Fpsndesc varchar(20), FpsnBirth varchar(20), FpsnSalary number(8,2) ); Insert into T_PsnSalary(Fpsncode,Fpsndesc,FpsnBirth,FpsnSalary) Values('C001','张三','1986.01.10',1100); Insert into T_PsnSalary(Fpsncode,Fpsndesc,FpsnBirth,FpsnSalary) Values('C002','李四','1980.10.10',3000); Insert into T_PsnSalary(Fpsncode,Fpsndesc,FpsnBirth,FpsnSalary) Values('C003','王五','1996.12.10',800); create or replace package A_GetData is function Getage(birthst varchar,birthend varchar) return integer; function Getsalary(VFpsncode varchar) return number; end A_Getdata; / create or replace package body A_GETDATA is function Getage(birthst varchar,birthend varchar) return integer is V_birth integer; ToDateEnd Date; Toyear number(4); Tomonth number(4); Fromyear number(4); Frommonth number(4); begin if (birthend='') or (birthend is null) then select sysdate into ToDateEnd; end if; Toyear := to_number(to_char(ToDateEnd,'YYYY')); Tomonth := to_number(to_char(ToDateEnd,'MM')); Fromyear := to_number(substr(birthst,1,4)); Frommonth := to_number(substr(birthst,6,2)); if Tomonth-Frommonth>0 then V_birth:=Toyear-fromyear; else V_birth:=Toyear-fromyear-1; end if; return(V_birth); end; function getSalary(VFpsncode varchar) return number is V_psnSalary number(8,2); begin Select FpsnSalary into V_psnSalary from T_PsnSalary where Fpsncode=VFpsncode; return(V_psnSalary); end; end A_GETDATA; / select a.*,zkm.A_getdata.Getage(Fpsnbirth,'') age from zkm.T_psnsalary a; select zkm.A_getdata.Getsalary('C001');
使用gs_dump导出信息:
[omm@gaussdb backup]$ gs_dump -p 30100 -U root -W jiamiPwd -f /backup/zkmdb.dmp -F c -E 'UTF8' -C zkmdb gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: WARNING: could not resolve dependency loop among these items: gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: FUNCTION getage (ID 1893 OID 23562) gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: object type 20 (ID 6624 OID 23561) gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: PRE-DATA BOUNDARY (ID 6626) gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: WARNING: could not resolve dependency loop among these items: gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: FUNCTION getsalary (ID 1894 OID 23563) gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: object type 20 (ID 6624 OID 23561) gs_dump[user='root'][localhost][port='30100'][zkmdb][sorter][2024-03-12 17:33:21]: PRE-DATA BOUNDARY (ID 6626) gs_dump[user='root'][localhost][port='30100'][zkmdb][2024-03-12 17:33:21]: The total objects number is 451. gs_dump[user='root'][localhost][port='30100'][zkmdb][2024-03-12 17:33:21]: [100.00%] 451 objects have been dumped. gs_dump[user='root'][localhost][port='30100'][zkmdb][archiver][2024-03-12 17:33:21]: WARNING: archive items not in correct section order gs_dump[user='root'][localhost][port='30100'][zkmdb][2024-03-12 17:33:21]: dump database zkmdb successfully gs_dump[user='root'][localhost][port='30100'][zkmdb][2024-03-12 17:33:21]: total time: 3292 ms
问题2:
以纯文本格式导出库 zkmdb 的某些schema的元数据,导出语句如下:
其中当出现 -n 指定schema导出的时候,-C参数会失效。
gs_dump -p 8000 -U root -W jiamipwd -f /backup/metadata_zkmdb.sql -F p -s -C zkmdb -n user1 -n user2 -n user3 -n user4
一些含义: gs_dump --help -f, --file=FILENAME -F, --format=c|d|t|p output file format (custom, directory, tar,plain text (default)) -E, --encoding=ENCODING -C, --create include commands to create database in dump --exclude-function do not dump function and procedure -s, --schema-only dump only the schema, no data
问题3:
nohup gs_dump 参数1 参数2 参数3 > /backup/exp_db.log &
使用日志重定向保存日志时,指挥记录部分导出信息的日志到log文件中,而大部分如报错信息指挥在当前屏幕中显示而不记录日志。
略。