云数据库 GaussDB-CREATE DATABASE:示例

时间:2023-11-01 16:22:51

示例

 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031323334353637383940
--创建jim和tom用户。openGauss=# CREATE USER jim PASSWORD 'xxxxxxxxxx';openGauss=# CREATE USER tom PASSWORD 'xxxxxxxxxx';--创建一个GBK编码的数据库music(本地环境的编码格式必须也为GBK)。openGauss=# CREATE DATABASE music ENCODING 'GBK' template = template0;--创建数据库music2,并指定所有者为jim。openGauss=# CREATE DATABASE music2 OWNER jim;--用模板template0创建数据库music3,并指定所有者为jim。openGauss=# CREATE DATABASE music3 OWNER jim TEMPLATE template0;--设置music数据库的连接数为10。openGauss=# ALTER DATABASE music CONNECTION LIMIT= 10;--将music名称改为music4。openGauss=# ALTER DATABASE music RENAME TO music4;--将数据库music2的所属者改为tom。openGauss=# ALTER DATABASE music2 OWNER TO tom;--删除数据库。openGauss=# DROP DATABASE music2;openGauss=# DROP DATABASE music3;openGauss=# DROP DATABASE music4;--删除jim和tom用户。openGauss=# DROP USER jim;openGauss=# DROP USER tom;--创建兼容TD格式的数据库。openGauss=# CREATE DATABASE td_compatible_db DBCOMPATIBILITY 'TD';--创建兼容ORA格式的数据库。openGauss=# CREATE DATABASE ora_compatible_db DBCOMPATIBILITY 'ORA';--删除兼容TD、ORA格式的数据库。openGauss=# DROP DATABASE td_compatible_db;openGauss=# DROP DATABASE ora_compatible_db;
support.huaweicloud.com/distributed-devg-v2-opengauss/gaussdb-v5r2c10-0571.html