After a user is created, you can view the privileges granted to the user as needed.
View user privileges by using SQL statements
Log on to an Oracle tenant of OceanBase Database.
Execute the following statements to view the privileges granted to a user:
View the system privileges granted to a user.
The administrator can query the
DBA_SYS_PRIVSview for the system privileges granted to a user.obclient> SELECT * FROM DBA_SYS_PRIVS WHERE grantee='SECUSER'; +---------+-----------------+--------------+ | GRANTEE | PRIVILEGE | ADMIN_OPTION | +---------+-----------------+--------------+ | SECUSER | CREATE SEQUENCE | NO | +---------+-----------------+--------------+ 1 row in setFor more information about the fields in the
DBA_SYS_PRIVSview, see DBA_SYS_PRIVS.View the system privileges granted to the current user.
Both the current user and the administrator can query the
USER_SYS_PRIVSview for the system privileges granted to the current user.obclient> SELECT * FROM USER_SYS_PRIVS; +----------+----------------+--------------+ | USERNAME | PRIVILEGE | ADMIN_OPTION | +----------+----------------+--------------+ | USER2 | CREATE SESSION | NO | | USER2 | CREATE TABLE | YES | +----------+----------------+--------------+ 2 row in setFor more information about the fields in the
USER_SYS_PRIVSview, see USER_SYS_PRIVS.View the object privileges granted to a user.
The administrator can query the
DBA_TAB_PRIVSview for the object privileges granted to a user.obclient> SELECT * FROM DBA_TAB_PRIVS WHERE grantee='SECUSER'; +---------+-------+------------+---------+-----------+-----------+-----------+ | GRANTEE | OWNER | TABLE_NAME | GRANTOR | PRIVILEGE | GRANTABLE | HIERARCHY | +---------+-------+------------+---------+-----------+-----------+-----------+ | SECUSER | SYS | TBL4 | SYS | SELECT | NO | NO | | SECUSER | SYS | TBL4 | SYS | UPDATE | NO | NO | +---------+-------+------------+---------+-----------+-----------+-----------+ 2 rows in setFor more information about the fields in the
DBA_TAB_PRIVSview, see DBA_TAB_PRIVS.View the object privileges granted to the current user.
Both the current user and the administrator can query the
USER_TAB_PRIVSview for the object privileges granted to the current user.obclient> SELECT * FROM USER_TAB_PRIVS; +---------+-------+-----------------+---------+-----------+-----------+-----------+ | GRANTEE | OWNER | TABLE_NAME | GRANTOR | PRIVILEGE | GRANTABLE | HIERARCHY | +---------+-------+-----------------+---------+-----------+-----------+-----------+ | PUBLIC | SYS | VERIFY_FUNCTION | SYS | EXECUTE | NO | NO | +---------+-------+-----------------+---------+-----------+-----------+-----------+ 1 row in setFor more information about the fields in the
USER_TAB_PRIVSview, see USER_TAB_PRIVS.View the role of a user.
The administrator can query the
DBA_ROLE_PRIVSview for the role of a user.obclient> SELECT * FROM DBA_ROLE_PRIVS WHERE grantee='USER2'; +---------+--------------+--------------+--------------+ | GRANTEE | GRANTED_ROLE | ADMIN_OPTION | DEFAULT_ROLE | +---------+--------------+--------------+--------------+ | USER2 | ROLE1 | NO | YES | +---------+--------------+--------------+--------------+ 1 row in setFor more information about the fields in the
DBA_ROLE_PRIVSview, see DBA_ROLE_PRIVS.For more information about how to view the object privileges or system privileges of each role, see View a role.
View the role of the current user.
Both the current user and the administrator can query the
USER_ROLE_PRIVSview for the role of the current user.obclient> SELECT * FROM USER_ROLE_PRIVS; +---------+--------------+--------------+--------------+ | GRANTEE | GRANTED_ROLE | ADMIN_OPTION | DEFAULT_ROLE | +---------+--------------+--------------+--------------+ | SYS | ROLE1 | YES | YES | +---------+--------------+--------------+--------------+ 1 row in setFor more information about the fields in the
USER_ROLE_PRIVSview, see USER_ROLE_PRIVS.For more information about how to query the object privileges or system privileges of the current role, see View a role.
View user privileges in the OCP console
You can also view the privileges and role granted to a specified user in the OceanBase Cloud Platform (OCP) console.
Log on to the OCP console.
In the left-side navigation pane, click Tenants to go to the Tenants page.
In the tenant list, click a tenant whose Tenant Mode is Oracle to go to the Overview page.
In the left-side navigation pane, click User Management.
In the user list, find the target user and move the pointer over the System Permissions column to view the privileges of the user, or over the Roles column to view the roles assigned to the user.
