Solved

How to make synonym useful for all users

Posted on 2004-08-07
4
3,093 Views
Last Modified: 2010-05-18
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


0
Comment
Question by:anandabrata
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 11743047
You need to GRANT privileges to user (or role) also.

GRANT select on table1 to user2;

or

create role tab_select;
grant select on table1 to tab_select;
grant tab_select to user1;

0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 11745004
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.  
0
 
LVL 8

Expert Comment

by:annamalai77
ID: 11750302
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

0
 
LVL 8

Accepted Solution

by:
annamalai77 earned 50 total points
ID: 11750311
correct posting.

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;
grant insert on <syn.name> to public;
grant update on <syn.name> to public;
grant delete on <syn.name> to public;

will grant individual priviliges to the table for all users.

or

grant select on <syn.name> to <username>;
grant insert on <syn.name> to <username>;
grant update on <syn.name> to <username>;
grant delete on <syn.name> to <username>;

will grant individual priviliges for a specific user.

hope the above solves ur purpose.

regards
annamalai

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question