anandabrata
asked on
How to make synonym useful for all users
Hi,
I have a database instance. It has say two users. User1 and User2.
Say User1 has a table Table1. I want it to be made available by User2 in terms of a synonym.
So I create a public synonym using dba priviliges.
create public synonym nt_Table1 for user1.Table1;
Now when I go into User2 and do a select e.g
Select * from nt_Table1; I am unable to access that data.
But for sys login the same query returns me the data.
Please tell me as to why is this happening? What should I do so that the synonym returns me data even in User2 login.
Regards,
Anand
I have a database instance. It has say two users. User1 and User2.
Say User1 has a table Table1. I want it to be made available by User2 in terms of a synonym.
So I create a public synonym using dba priviliges.
create public synonym nt_Table1 for user1.Table1;
Now when I go into User2 and do a select e.g
Select * from nt_Table1; I am unable to access that data.
But for sys login the same query returns me the data.
Please tell me as to why is this happening? What should I do so that the synonym returns me data even in User2 login.
Regards,
Anand
Synonyms and grants are two different things. Synonyms are simply a shorter way of refering to an object, so you can use just the object name, rather than the full: "shema.object_name" syntax when you are in a different schema. But, the Oracle security rules still apply. User2 cannot access objects in User1's schema whether synonyms exist for them or not, if User1 has not granted permission to User2 to use them.
hi there
well what u have done is just created an alias for a table. u have give permission to other users who can access the table using the alias name
create public synonym <syn.name> for <tablename>;
grant all on <syn.name> to public;
will grant all priviliges to the table ie select, insert, delete, update for all users.
or
grant select on <syn.name> to public;
will grant select priviliges to the table ie select, insert, delete, update for all users.
or
grant select on <syn.name> to <username>;
will grant select priviliges to the table ie select, insert, delete, update for a specific user.
hope the above solves ur purpose.
regards
annamalai
well what u have done is just created an alias for a table. u have give permission to other users who can access the table using the alias name
create public synonym <syn.name> for <tablename>;
grant all on <syn.name> to public;
will grant all priviliges to the table ie select, insert, delete, update for all users.
or
grant select on <syn.name> to public;
will grant select priviliges to the table ie select, insert, delete, update for all users.
or
grant select on <syn.name> to <username>;
will grant select priviliges to the table ie select, insert, delete, update for a specific user.
hope the above solves ur purpose.
regards
annamalai
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
GRANT select on table1 to user2;
or
create role tab_select;
grant select on table1 to tab_select;
grant tab_select to user1;