nccloud搭配华为云pg数据库如何建库?

部署nccloud,搭配华为云PG (增强版),如何建库?



强调:在升库前必需修改sysconfig的数据库连接字段,增加参数配置如下图:

增加参数为:?autosave=always   -------注意,该参数自2021.05版本起无需添加

另:升库完毕后,务必去掉该参数。并重启环境。


http://nccloud.yytimes.com/uploads/answer/20200928/3500cfc3f666cd3d2bbfec0476aff16d.png

已邀请:

#创建表空间



#注意:华为云PG创建表空间为一次性操作,执行1次即可,后续数据库自行管理表空间大小(如为私有化部署,请确认如下目录存在,且用户为postgres)



CREATE TABLESPACE nnc_index01 LOCATION '/data/nnc_index01';

CREATE TABLESPACE nnc_data01 LOCATION '/data/nnc_data01';


 



#使用有管理权限的用户创建数据库test_nccdb 为数据库名



CREATE DATABASE test_nccdb TABLESPACE  nnc_data01;




#切换数据库连接到test_nccdb 库里打开sql执行窗口执行。t_nccloud 为用户名,NCcloud为密码



create user t_nccloud password 'NCcloud'


#赋权



grant ALL ON DATABASE test_nccdb TO t_nccloud;
grant ALL ON TABLESPACE nnc_data01 TO t_nccloud;
grant ALL ON TABLESPACE nnc_index01 TO t_nccloud;


#如果赋权错误,可以取消赋权



revoke all on database test_nccdb from t_nccloud
revoke all on tablespace nnc_data01 from t_nccloud
revoke all on tablespace nnc_index01 from t_nccloud


 

创建schema 



 




CREATE SCHEMA 名称 AUTHORIZATION 用户名;


 

当前SCHEMA用户,赋权schema给其他用户

grant all ON schema tims_0001 to t_nccloud_xk021337;
grant select on all tables in schema tims_0001 to t_nccloud_xk021337

当前SCHEMA用户,赋权schema 全权限给其他用户

grant all ON schema tims_0001 to t_nccloud_xk021337;
grant select on all tables in schema tims_0001 to t_nccloud_xk021337

要回复问题请先登录注册