Use of synonyms in oracle

oracle

I want to know the usage of Synonyms in oracle.I have searched in internet there i have learned like synonyms will be created in one schema and we can use that in another schema. But still am not clear with synonyms.Can anyone clear my doubt about Synonyms

Best Answer

In my experience, synonyms are generally used for the sake of convenience. As an example, in my environment, we employ synonyms so that the developers don't have to worry about properly writing up cross-schema joins. By utilizing synonyms, our developers don't need to qualify any object with a schema in their SQL statements, because everything they need is either in their schema, or looks to be (because of the synonym). While some would argue this is poor practice, we're just tired of educating round after round of developers about proper database scripting and security standards.

As Travis alluded to below, creating a synonym for an object in a different schema doesn't mean you don't have to worry about security. The proper GRANTs to the base objects are still required and using good judgement on the level of permissions granted is always encouraged.

For me, synonyms reduce my total cost of ownership on administrative tasks. I'm sure there are other uses for Synonyms I've not touched on, but hopefully that helps by giving you a practical situation where synonyms are in fact very useful.