1. Check System Privileges for a User
To check if a user has system privileges like CREATE TABLE, CREATE ANY TABLE, etc., you can query the DBA_SYS_PRIVS or USER_SYS_PRIVS view.
For a specific user (using DBA_SYS_PRIVS, available to DBAs):
SELECT privilegeFROM dba_sys_privsWHERE grantee = 'USERNAME';2. Check Object Privileges for a User
To check whether a user has specific object privileges (like SELECT, INSERT, UPDATE, DELETE on tables), you can query the DBA_TAB_PRIVS or USER_TAB_PRIVS view.
SELECT table_name, privilegeFROM dba_tab_privsWHERE grantee = 'USERNAME';3. Check Role Privileges for a User
If a user has been granted roles, which can include the ability to CREATE TABLE, you can check the roles granted using the DBA_ROLE_PRIVS or USER_ROLE_PRIVS view.
SELECT granted_roleFROM dba_role_privsWHERE grantee = 'USERNAME';4. Check if the User Has a Quota on a Tablespace
For creating tables, the user must also have a sufficient quota on the tablespace where the table will be created. You can check tablespace quotas using the following query:
SELECT tablespace_name, max_bytesFROM dba_ts_quotasWHERE username = 'USERNAME';Example: Checking if a User Can Create Tables
You can combine the above queries to check if a user has the CREATE TABLE privilege and sufficient tablespace quota:
SELECT privilegeFROM dba_sys_privsWHERE grantee = 'USERNAME'AND privilege = 'CREATE TABLE';