sqldatabaseoraclesqlplusdatabase-security

How to link the two users so they can both view the same tables SQL*Plus


[![enter image description here]2]2I made my user with my tables etc. Then I created a new user with privileges but the tables are not there in the new user... how can I link the two users so both users can make use of the tables that they have access to?

I used 'Grant all on tablex to user2;' however, when I connect to user2, I am unable to view the table tales (this table x is on the User1 account). My question is how do I fix this problem?


Solution

  • We aren't looking over your shoulder, but I'll bet a cookie that you are not qualifying the table name.

    If you query like this:

    select * from mytable;
    

    oracle will only look in your own name space -- your own tables - for a table named MYTABLE.

    If you want to see someone else's tables, you have to qualify with the owner name:

    select * from otheruser.mytable;
    

    If you don't want to qualify the name, you need to create a synonym in your own schema, pointing to the table in the other schema.

    As USER2:

    create synonym mytable on otheruser.mytable;