--View User system permissions
SELECT * from Dba_sys_privs;
SELECT * from User_sys_privs;
--View User object permissions
SELECT * from Dba_tab_privs;
SELECT * from All_tab_privs;
SELECT * from User_tab_privs;
SELECT * from Dba_roles; --View all roles
--View the roles owned by the user:
SELECT * from Dba_role_privs;
SELECT * from User_role_privs;
--View the permissions that the role has
SELECT * from Role_sys_privs;
SELECT * from Role_tab_privs;
SELECT * from System_privilege_map; --View all system permissions
SELECT * from Table_privilege_map; --View All object permissions
--Query all the table names under all current users
SELECT * from tab;
SELECT * from Dba_tables;
SELECT * from Dba_objects;
SELECT * from Cat;
--View user-created tables
SELECT * from user_tables;--the current user's table
SELECT * from all_tables;--table for all users
SELECT * from dba_tables;--includes system tables
SELECT * FROM user_indexes;--querying table indexes for all users
--lookup table's primary key
Select cu.* from User_cons_columns cu, user_constraints au
where cu.constraint_name = Au.constraint_name
and Au.constraint_type = ' P ' and au.table_name = table to query
--lookup table's Uniqueness Index
Select column_name from User_cons_columns cu, user_constraints au
where cu.constraint_name = Au.constraint_name
and Au.constraint_type = ' U ' and au.table_name = table to query
--lookup table's foreign key
SELECT * FROM user_constraints C
where C.constraint_type = ' R ' and c.table_name = table to query
--Find the column name of the FOREIGN KEY constraint
SELECT * from User_cons_columns cl where cl.constraint_name = FOREIGN key Name
--Query the column name of the key referencing the table
SELECT * from User_cons_columns cl where cl.constraint_name = foreign key reference table key name
--Querying all columns of a table and their properties
Select t.*,c.comments from User_tab_columns t,user_col_comments C
where t.table_name = c.table_name and t.column_name = C.column_name
and t.table_name = table to query
Oracle Query Table