Updated on 2025-07-22 GMT+08:00

ALTER SYNONYM

Function

ALTER SYNONYM is used to modify the attribute of a synonym.

Precautions

  • Only the owner of the SYNONYM object can be changed.
  • Only the system administrator and the owner of the SYNONYM object can change its owner information.
  • The modifier must be a direct or indirect member of the new owner, and the new owner must have the CREATE permission on the schema to which the synonym belongs.

Syntax

1
2
ALTER SYNONYM synonym_name
    OWNER TO new_owner;

Parameter Description

Table 1 ALTER SYNONYM parameters

Parameter

Description

Value Range

synonym_name

Name of the synonym to be modified, which can include the schema name.

Name of an existing synonym.

OWNER TO

Clause used to modify the owner of a synonym.

-

new_owner

New owner of a synonym.

Valid username.

Examples

Create synonym t1.

1
CREATE OR REPLACE SYNONYM t1 FOR ot.t1;

Create user u1.

1
CREATE USER u1 PASSWORD '{password}';

Change the owner of the synonym t1 to u1.

1
ALTER SYNONYM t1 OWNER TO u1;

Helpful Links

CREATE SYNONYM and DROP SYNONYM