Oracle Synonyms

  • Synonyms are database objects, next to views
  • Any component having a name can make Synonyms
  • In place of table name, we can give the Synonym name.
  • It stores in data dictionary table.
  • Used to hide the original name by owner of the database object.
  • DML operations, DESC, SELECT allowed on Synonym.
  • Synonym provides security to tables.

SYNTAX:

CREATE SYNONYM synonym_name
FOR user_name.object_name@databaselink

Example:

CREATE SYNONYM emp_syn for emp;

CREATE SYNONYM emp_synonym
FOR scott.emp;

Synonyms are two types:
Private Synonym: Private synonym is created by users. Used by specific user which have permissions. By default synonyms are private.

Public Synonym is created by DBA.

Powered by k2schools