You can execute the DROP SYNONYM statement to delete a synonym.
DROP [PUBLIC] SYNONYM [ DATABASE. ]synonym;
Delete a public synonym. If you do not use PUBLIC, a private synonym is deleted.
[ DATABASE. ]synonym
The database to which the current synonym belongs. If you add PUBLIC to the statement, you do not need to specify the database for the synonym. synonym specifies the name of the synonym.
- Delete a synonym.
OceanBase(admin@test)>drop synonym test.s1; Query OK, 0 rows affected (0.03 sec)
- Delete a public synonym.
OceanBase(admin@test)>drop public synonym syn_pub; Query OK, 0 rows affected (0.02 sec)
To delete a private synonym, ensure that the synonym belongs to the specified database and you have the DROP ANY SYNONYM permission.
To delete a public synonym, ensure that you have the DROP PUBLIC SYNONYM permission.
To delete a public synonym, make sure that you add PUBLIC to the statement and do not specify the database.