云数据库 GAUSSDB-CREATE DATABASE:示例
时间:2025-07-25 09:29:42
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
--创建jim和tom用户。 openGauss=# CREATE USER jim PASSWORD '********'; openGauss=# CREATE USER tom PASSWORD '********'; --创建一个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-gaussdb/gaussdb-12-0359.html