Skip to content

How Oracle Rename Synonym

  • by

Private Synonym

To rename a private synonym, we should RENAME TO statement to rename it, but you have to login as the object's owner. For example:

SQL> show user
USER is "OE"
SQL> select object_type from user_objects where object_name = 'COUNTRIES';

OBJECT_TYPE
-----------------------
SYNONYM

SQL> rename countries to countries_bak;

Table renamed.

Although it returned "Table renamed.", the object is not necessarily a table.

Public Synonym

As for public synonym, we have to recreate it with different name. But before dropping it, it's safer to get the definition of synonym first.

Leave a Reply

Your email address will not be published. Required fields are marked *