云数据库 GAUSSDB-REASSIGN OWNED:示例

时间:2024-07-01 18:36:25

示例

 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
--创建test_jim和test_tom用户。
gaussdb=# CREATE USER test_jim PASSWORD '********';
gaussdb=# CREATE USER test_tom PASSWORD '********';

--查看自动创建的模式的拥有者为同名的用户。
gaussdb=# \dn test*
   List of schemas
   Name   |  Owner   
----------+----------
 test_jim | test_jim
 test_tom | test_tom
(2 rows)

--将所有test_jim拥有的数据库对象的属主更改为test_tom。
gaussdb=# REASSIGN OWNED BY test_jim TO test_tom;

--查看schema的信息,test_jim模式的属主更换为test_tom。
gaussdb=# \dn test*
   List of schemas
   Name   |  Owner   
----------+----------
 test_jim | test_tom
 test_tom | test_tom
(2 rows)

--删除test_jim和test_tom用户。
gaussdb=# DROP USER test_jim, test_tom CASCADE;
support.huaweicloud.com/centralized-devg-v8-gaussdb/gaussdb-42-0679.html