Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Bayat.

Asked: June 30, 2016 - 5:21 am UTC

Last updated: June 30, 2016 - 6:11 am UTC

Version: 11g

Viewed 1000+ times

You Asked

how to shadow user's tables' structure for other users.

I have two users (schemas) - USER1 and USER2.
USER1 has roles CONNECT and RESOURCE, but if i run 'DESC USER2.TABLE_NAME' i can show user2's table's structure. How can I forbid to show table's structure of another user?

and Connor said...

There must be some other privileges assigned here, because by default, you cant detect *anything* about another user's objects, eg

SQL> create user demo1 identified by demo1;

User created.

SQL> create user demo2 identified by demo2;

User created.

SQL>
SQL> alter user demo1 quota 100m on users;

User altered.

SQL>
SQL> create table demo1.t ( x int );

Table created.

SQL>
SQL> grant connect to demo1;

Grant succeeded.

SQL> grant connect to demo2;

Grant succeeded.

SQL>
SQL> conn demo1/demo1
Connected.

SQL> desc t
 Name                                                                    Null?    Type
 ----------------------------------------------------------------------- -------- ------------------------------------------------
 X                                                                                NUMBER(38)

SQL> conn demo2/demo2
Connected.

demo2@np12
SQL>
demo2@np12
SQL> desc t
ERROR:
ORA-04043: object t does not exist





Is this answer out of date? If it is, please let us know via a Comment