gs_dump的问题1
gaussdb使用的一些问题及解决办法
前置
create user hr with SYSADMIN password 'Gauss_234';
连接 hr 建表
create table t1(id int);
create table test(id int,name varchar(20);
insert into t1 values(1);
insert into t1 values(2);
insert into t1 values(3);
insert into test values(1,'aaa');
insert into test values(2,'bbb');
insert into test values(1,'ccc');
create database db10;
对应资料: 开发者指南-330集中式
场景1 执行成功,表没有导入导到新库里 对应资料7.4示例六
gs_dump -U z_test -f /home/Ruby/z2/z3.dump -p 8000 postgres -F c -W Gauss_234
gs_restore z3.dump -p 8000 -d db10 -e -c -s -n hr -t hr.t1 -W b3D#k9G#f0P_q7G#
t1前面不需要hr.,没有导入成功是因为-n需要新建。
需要create schema hr;
但是如果没有-t,只有-n,则可以自动新建schema.
场景2 执行成功,数据没有导入导到新库里 对应资料7.4示例七
gs_restore z3.dump -p 8000 -d db10 -e -a -n hr -t hr.t1 -W b3D#k9G#f0P_q7G#
-s 是只导入表结构,-a是只导入表数据。
-a之前需要先执行-s,先导入表结构,不然会table t1不存在的错误。
场景3 执行报错 报错schema "hr" does not exist 对应资料示例十
gs_dump -U hr -f /home/Ruby/z1/bk1.sql -p 8000 postgres -F c
gs_restore bk1.sql -p 8000 -d db3 -n hr -e -c
场景4 5 6 报错 query failed: ERROR: permission denied to set role "role1"
去掉-c参数即可,只有-n的,加上-c不会新建schema
场景4 对应资料 8.1.4 示例一 二
gs_dump -U usr2 -f /home/Ruby/usr1.tar -p 8000 postgres --role role1 --rolepassword Gauss_234 -F t -W Gauss_234
场景5 对应资料 8.1.4 示例 三
gs_dumpall -U usr1 -f z2/z1.sql -p 8000 --role role1 --rolepassword abc@1234 -W Gauss_234
场景6 对应资料 7.4 示例 十三
gs_dump -U z_test -f /home/Ruby/z2/z1.tar -p 8000 postgres -F t -W Gauss_234
gs_restore -U usr1 z2/z1.tar -p 8000 -d db9 --role role1 --rolepassword Gauss_234 -W Gauss_234
--role,--rolepassword 低权限用户不允许设置高权限用户了,此参数没有什么用处了。建议删除。
对应解决方法:
create user jack password '******@123Pwd';
create user hr password '******@123Pwd' sysadmin;
grant hr to jack;
gs_dump postgres -f 1.dump -p 33700 -U jack -W ******@123Pwd -F c --role hr --rolepassword ******@123Pwd
- dump没有导出node group
(1)创建node group ;
(2)在该node group 上创建表,并包含fillfactor信息。
(3)执行gs_dump postgres -p 25108 -s -f db.sql
(4)发现db.sql中没有node group和fillfactor等关键信息
解决方法
在dump的时候指定--include-nodes
在dumpall的时候指定--include-nodes 和 --dump-nodes


不能识别大写
gs_dump postgres -p 30050 -F p -U rdsAdmin -W huawei@123Pwd -f 1.sql -T T5
no matching tables were found for pattern "T5"
应该加上转义
gs_dump postgres -p 30050 -F p -U rdsAdmin -W huawei@123Pwd -f 1.sql -T \"T5\"

浙公网安备 33010602011771号