Use the ALTER SYNONYM command to rename or change the owner of a synonym.
ALTER SYNONYM <synonym> [ RENAME TO <new_name> ]
[ OWNER TO <new_owner> ]
The ALTER SYNONYM command takes the following inputs:
| Input | Description |
|---|---|
| RENAME TO <new_name> | The new name of the synonym. |
| OWNER TO <new_owner> | The name of the new owner. |
| <synonym> | The name of the synonym. |
The ALTER SYNONYM command produces the following output:
| Output | Description |
|---|---|
| ALTER SYNONYM | The command was successful. |
You must be the admin user, the synonym owner, the owner of the database or schema where the synonym is defined, or your account must have the Alter privilege for this synonym or the Synonym object class. If you are changing the owner of the synonym, you must have List access to the user account.
MYDB.SCH1(USER)=> ALTER SYNONYM payroll RENAME TO pr;
MYDB.SCH1(USER)=> ALTER SYNONYM pr OWNER TO accounting;