Note
This view is available starting with V2.2.30.
Purpose
The view displays all synonyms in the current tenant.
Applicability
This view applies only to OceanBase Database in Oracle mode.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| OWNER | VARCHAR2(128) | NO | The owner of the synonym. |
| SYNONYM_NAME | VARCHAR2(128) | NO | The name of the synonym. |
| TABLE_OWNER | VARCHAR2(128) | NO | The owner of the referenced object. |
| TABLE_NAME | VARCHAR2(128) | NO | The name of the referenced object. |
| DB_LINK | VARCHAR2(128) | NO | If the synonym references a DB link, this column indicates the name of the DB link. Currently, synonyms do not support DB links. |
Sample query
Query all synonyms in the current tenant.
obclient [SYS]> SELECT * FROM SYS.DBA_SYNONYMS;
The query result is as follows:
+----------+--------------+-------------+------------+---------+
| OWNER | SYNONYM_NAME | TABLE_OWNER | TABLE_NAME | DB_LINK |
+----------+--------------+-------------+------------+---------+
| __public | SYN_PUB | SYS | TEST | NULL |
| SYS | S1 | SYS | TEST | NULL |
+----------+--------------+-------------+------------+---------+
2 rows in set
References
ALL_SYNONYMS describes how to query all synonyms in the current tenant.
USER_SYNONYMS describes how to query synonyms owned by the current user.
For more information about synonyms, see Manage synonyms.