轻松上手openGauss第4期:openGauss基本管理(上)_第1页
轻松上手openGauss第4期:openGauss基本管理(上)_第2页
轻松上手openGauss第4期:openGauss基本管理(上)_第3页
轻松上手openGauss第4期:openGauss基本管理(上)_第4页
轻松上手openGauss第4期:openGauss基本管理(上)_第5页
已阅读5页,还剩47页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

轻松上手openGauss轻松上手openGaussopenGaussGauss松鼠会Gauss松鼠会2Gauss松鼠会数据库和表空间管理模式管理oopenGaussopenGauss数据库和表空间管理GaussGauss松鼠会4Gauss松鼠会Gauss松鼠会系实际上是表的数学术语);Ø一个由单个openGauss服务器实例管理的数据库集合组成一个数据库集簇(DatabaseCluster);ses及相关配置文件。5表空间管理概述Gauss松鼠会表空间pg_default:-->系统目录对象-->用户表及索引-->临时表及索引表空间pg_global:-->数据字典表6表空间管理示例Gauss松鼠会createcreatetablespacetbs2relativelocation'tablespace/tbs2'maxsize'100G';createtablespacetbs3ownerjacklocation'/gauss/data/tbs3';\\dbselect*frompg_tablespace_location((selectoidfrompg_tablespacewherespcname='tbs2'));selectoid,*frompg_tablespace;alteraltertablespacetbs3renametotbs4;altertablespacetbs4ownertojack;altertablespacetbs4resizemaxsizeunlimited;dropdroptablespacetbs4;--Tips:删除表空间的前提条件是该表空间内容为空。7Gauss松鼠会8Gauss松鼠会createcreatedatabasemydb2;createdatabasemydb3withowner=jackencoding='UTF-8'LC_COLLATE='zh_CN.UTF-8'LC_CTYPE='zh_CN.UTF-8'DBCOMPATIBILITY='A'TABLESPACE=tbs1CONNECTIONLIMIT=1000;--若区域设置为C(或POSIX),则允许所有的编码类型,但是对于其他的区域设置,字符编码必须和区域设置相同。alteralterdatabasemydb3renametomydb4;alterdatabasemydb2ownertouser1;alterdatabasemydb2settablespacetbs1;dropdropdatabasemydb4;\l\lselect*frompg_database;oopenGauss用户和模式管理GaussGauss松鼠会Gauss松鼠会postgres=#showsearch_path;search_path"$user",public10Gauss松鼠会createcreateschemasch1;createschemasch2authorizationjack;alteralterschemasch2renametosch3;alterschemasch1ownertojack;dropdropschemasch3;Tips:Ø不建议创建以PG_为前缀的schema名,该类的schema是为数据库系统预留的。Ø每个数据库都有pg_catalogschema,它包含系统表、内置数据类型、函数、操作符。Ø搜索路径(search_path)始终以pg_temp和pg_catalog这两个schema作为搜索路径顺序中的前两位。用户角色及权限概述Gauss松鼠会Gauss松鼠会openGauss安装过程中自动生成的帐户(与安装时使用的操作系统用户同名)称为初始用户。初在第一次登录数据库后,要及时修改初始用户的密码。系统管理员是指具有SYSADMIN属性的帐户,默认安装情况下具有与对象所有者相同的权限,但不包括dbe_perf模式的对象权限。创建系统管理员可以使用初始用户或者系统管理员用户身份连接数据库,并使用带SYSADMIN选项的CREATEUSER语句或ALTERUSER语句进行设置。三权分立Gauss松鼠会将系统管理员的部分权限分立给安全管理员和审计管理员,形成系统管理员、安全管理员和审计管理三权分立后,系统管理员将不再具有CREATEROLE属性(安全管理员)和AUDITADMIN属性(审计三三权分立Tips:ü初始用户的权限不受三权分立设置影响ü三权分立的设置参数enableSeparationOfDutyGauss松鼠会含立模式下,创建具有INDEPENDENT属性的私有用户。针对该用户的对象,系统管理员(包括初始用户)和拥有CREATEROLE属性的安全管理员在未经Gauss松鼠会useruser1useruser1identifiedby'gauss@123';createuseruser2withsysadminpassword'gauss@123';createuseruser3withVALIDBEGIN'2020-12-3123:59:59'VALIDUNTIL'2020-12-0100:00:00'identifiedby'gauss@123'CONNECTIONLIMITalteralteruseruser1withsysadmin;alteruseruser2renametouser4;createcreateuseruser_independwithindependentidentifiedby'gauss@123';grantallprivilegesondatabasemydbtouser_independ;$$gs_gucreload-Nall-Iall-c"enableseparationofduty=on"$gs_om-tstop&&gs_om-tstartdropdropuseruser4;Gauss松鼠会Gauss松鼠会Gauss松鼠会Gauss松鼠会grantallprivilegesondatabasemydbtouser3;grantallprivilegesontablespacetbs1touser3;agrantusageonschemasch1touser3;grantexecuteonfunctionfunc_add_sql(int,int)touser3;grantexecuteonfunctionproc_emp(var_empnoint,OUTv_namevarchar,OUTv_jobvarchar)touser3;grantselect(empno,ename,sal),update(comm)onempTOuser3;grantselect,insert,update,deleteonalltablesinschemasch1touser3;grantallprivilegesonemptouser3withgrantoption;antjacktouserwithadminoptionrevokejackfromuser1;19oopenGaussGauss松鼠会常见数据类型介绍21Gauss松鼠会22Gauss松鼠会23Gauss松鼠会Gaus

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论