N
The Global Insight

What is Oracle Database synonym?

Author

John Johnson

Updated on May 22, 2026

The Oracle Database adapter allows you to perform operations on synonyms. A synonym is an alias or friendly name for the database objects (such as tables, views, stored procedures, functions, and packages).

What is a database synonym in Oracle and what is it used for?

A synonym may have the same name as the underlying object, provided the underlying object is contained in another schema. Oracle Database Resolution of Synonyms: Example Oracle Database attempts to resolve references to objects at the schema level before resolving them at the PUBLIC synonym level.

What are the types of synonyms in Oracle?

Synonyms can be public or private. A public synonym is accessible to every user in a database and owned by a specified group named PUBLIC while a private synonym is stored a specific schema owned by a specific user and available only to that user. Create synonym – show you how to create a new synonym for a table.

How do I find synonyms in Oracle?

“how to get list of synonyms in oracle” Code Answer

  1. -- Depending on connected user grants:
  2. SELECT * FROM USER_SYNONYMS WHERE SYNONYM_NAME = 'syn_name'; -- User synonyms.
  3. SELECT * FROM ALL_SYNONYMS WHERE TABLE_NAME = 'table_name'; -- Available to user.

What is Oracle Public synonym?

Oracle uses a public synonym only when resolving references to an object if the object is not prefaced by a schema and the object is not followed by a database link. If you omit this clause, the synonym is private and is accessible only within its schema. A private synonym name must be unique in its schema.

What is Synonym in Oracle, when to use a synonym || Oracle Database Tutorial

What is the advantage of synonym in Oracle?

Advantages of Using Synonyms

You can create a synonym for an object in a schema, and use the synonym in your SQL statement to access the object. If you need to access the underlying object in a different schema, modify the definition of the synonym to point to the object in a different schema.

What is DBMS synonym?

In databases, a synonym is an alias or alternate name for a table, view, sequence, or other schema object. They are used mainly to make it easy for users to access database objects owned by other users.

What is the use of synonym in SQL?

A synonym is a database object that serves the following purposes: Provides an alternative name for another database object, referred to as the base object, that can exist on a local or remote server.

How do you run a synonym in Oracle?

Oracle CREATE SYNONYM

  1. First, specify the name of the synonym and its schema. ...
  2. Second, specify the object for which you want to create the synonym after the FOR keyword. ...
  3. Third, use the OR REPLACE option if you want to re-create the synonym if it already exists.

What are two reasons to create synonyms?

D. You want to work on your own tables. E. You want to use another schema's tables.

What is difference between view and synonym in Oracle?

View is logical and does not occupies space. Synonym can be created for single table, view, sequence or index. Synonym is physical and needs space.

What is private synonym in Oracle?

You can create both public and private synonyms. A public synonym is owned by the special user group named PUBLIC and is accessible to every user in a database. A private synonym is contained in the schema of a specific user and available only to the user and to grantees for the underlying object.

What is database synonym in SQL?

In SQL Server, a synonym is an alias or alternative name for a database object such as a table, view, stored procedure, user-defined function, and sequence. A synonym provides you with many benefits if you use it properly.

Can we update synonym in Oracle?

Use the ALTER SYNONYM statement to modify an existing synonym. To modify a private synonym in another user's schema, you must have the CREATE ANY SYNONYM and DROP ANY SYNONYM system privileges. To modify a PUBLIC synonym, you must have the CREATE PUBLIC SYNONYM and DROP PUBLIC SYNONYM system privileges.

How do I remove synonyms in Oracle?

Use the DROP SYNONYM statement to remove a synonym from the database or to change the definition of a synonym by dropping and re-creating it. To drop a private synonym, either the synonym must be in your own schema or you must have the DROP ANY SYNONYM system privilege.

How do I create a synonym in SQL?

Use SQL Server Management Studio

  1. In Object Explorer, expand the database where you want to create your new view.
  2. Right-click the Synonyms folder, then select New Synonym....
  3. In the Add Synonym dialog box, enter the following information. Synonym name. Type the new name you will use for this object. Synonym schema.

What is looping chain of synonyms?

ORA-01775: looping chain of synonyms – Basically means that you created a synonym that points to another object in a circle.

Can we create synonym for package in Oracle?

Use the CREATE SYNONYM statement to create a synonym, which is an alternative name for a table, view, sequence, procedure, stored function, package, materialized view, Java class schema object, user-defined object type, or another synonym. Synonyms provide both data independence and location transparency.

How do synonyms work in SQL Server?

A synonyms in SQL Server are database objects that give an alternative name to the database objects existing locally or on the remote server. Also, they provide an abstraction layer to protect the application from any changes in the base object.

How do I check synonyms in SQL?

This query returns 8 columns;

  1. synonym_name Name of the synonyms.
  2. server_name Name of the server.
  3. synonym_definition Details of the synonyms.
  4. DB_name Name of the database.
  5. schema_name Name of the schema.
  6. table_name Name of the table.
  7. create_date Creation date of the synonyms.
  8. modify_date Modification date of the synonyms.

Can we insert data into synonym in Oracle?

No; as the others have said, synonyms have nothing to do with privileges.

What is synonym in MySQL?

MySQL Synonym

A synonym is merely another name for a table or a view. Synonyms are usually created so a user can avoid having to qualify another user's table or view to access the table or view. Synonyms can be created as PUBLIC or PRIVATE.

What happens to synonym when table is dropped in Oracle?

All synonyms for a dropped table remain, but return an error when used. All extents allocated for a table that is dropped are returned to the free space of the tablespace and can be used by any other object requiring new extents or new objects.

How do you know if public is private or synonym?

select * from all_synonyms where owner IN ('SCHEMA_USER1','SCHEMA_USER2'); If you are logged in as a particular user, then this will show all the synonymns private to the user. select * from user_synonyms; If you are looking for only public synonyms, this query may be close to what you are looking for.