help me to understand the synonym concept while providing grant permissions to users

There is a table test created by info user.
To provide permissions to other user below is the syntax i have used.

create or replace synonym info1.test for info.test
GRANT SELECT,INSERT,UPDATE,ALTER,DELETE ON info.test TO info1

is it mandatory to create synonym while granting permissions to other user?
suggest me how it helps.
LVL 2
srikoteshAsked:
Who is Participating?
 
Geert GConnect With a Mentor Oracle dbaCommented:
no, not mandatory

but when logged on as info1, the full schema info. has to be supplied

this works too:
alter session set current_schema=info;
select * from test;

Open in new window

0
 
awking00Connect With a Mentor Commented:
It is certainly not mandatory to create a synonym when granting permissions to other users. However, it can be beneficial in many cases. For example, say there is a schema called project_fiscal_year_2018  that contains a staging table named input_data_2018 that has been granted access permissions to other users. If the five other users only need to get certain records, they would each have to select from project_fiscal_year_2018.input_data_2018 with the fully qualified name. However, creating a synonym for that table with a name like stg_2018 would make things a lot easier.
0
 
Mark GeerlingsConnect With a Mentor Database AdministratorCommented:
Synonyms and grants are two different and independent things.  A synonym just provides a shorter way to refer to an object.  Instead of having to use the full "owner.table_name" syntax, you can simply use the "synonym_name" to refer to the object the synonym points to.

But, without a grant, a synonym doesn't help you.  If you don't have a grant, you can't do anything with the object even if a synonym allows you to refer toit.
0
 
srikoteshAuthor Commented:
hi experts,

Thanks for valuable suggestions.
which statement i need to give first.
is there any order first grant then synonym or
synonym then grant

create or replace synonym info1.test for info.test
GRANT SELECT,INSERT,UPDATE,ALTER,DELETE ON info.test TO info1
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.