Search code examples
databaseoracle-databasedata-dictionary

View all table contain in 'HR' Account (Oracle 11g)


SQL> select * from dba_hr_tables;
 select * from dba_hr_tables  
               * ERROR at line 1: ORA-00942: table or view does not exist.

Please help me out to find all table contain in HR User ... Thanks.


Solution

  • If I understand the question correctly, you're looking for all the tables owned by user HR.

    If you have a user with system privileges, you could use the following:

    SELECT table_name
    FROM   dba_tables
    WHERE  owner = 'HR'
    

    If you don't. but have a user with privileges on HR's tables, you could use all_tables instead of dba_tables:

    SELECT table_name
    FROM   all_tables
    WHERE  owner = 'HR'
    

    Alternatively, if you're able to logon as the HR user, you could do so and use:

    SELECT table_name
    FROM   user_tables