Oracle 23.26SQLLab-verified · 2026-11-30

ORA-01471: cannot create a synonym with same name as object

The synonym would have the same owner and name as the object it points to.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-01471: cannot create a synonym with same name as object

Jump to a cause

  1. 01Owner prefix missing: CREATE SYNONYM orders FOR orders
  2. 02Script run as the table owner instead of the application user

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-30 · container image gvenzl/oracle-free:23-slim

A synonym is just another name for an object. Oracle refuses to create one whose own owner and name are exactly the same as its target, because it would point to itself.

In both cases below the table is LAB_B.ORDERS and the synonym is called ORDERS. What matters is which schema runs CREATE SYNONYM and whether the target has an owner prefix.

01Owner prefix missing: CREATE SYNONYM orders FOR orders

LAB_A wanted a shortcut to LAB_B.ORDERS but wrote FOR orders without the owner. An unqualified target is read as LAB_A.ORDERS, the same name as the synonym, so the statement fails with ORA-01471.

Setup
Setuprun as lab_b
CREATE TABLE orders (order_id NUMBER PRIMARY KEY, amount NUMBER);
INSERT INTO orders VALUES (1, 100);
COMMIT;
GRANT SELECT ON orders TO lab_a;
OUTPUT
Table created.


1 row created.


Commit complete.


Grant succeeded.
Reproducerun as lab_a
CREATE SYNONYM orders FOR orders;
✕ ERROR
CREATE SYNONYM orders FOR orders
*
ERROR at line 1:
ORA-01471: cannot create a synonym with same name as object
Help: https://docs.oracle.com/error-help/db/ora-01471/
Check the causerun as lab_a
COLUMN owner FORMAT A8
COLUMN table_name FORMAT A10
SELECT owner, table_name FROM all_tables WHERE table_name = 'ORDERS';
OUTPUT
OWNER    TABLE_NAME
-------- ----------
LAB_B    ORDERS

1 row selected.

ALL_TABLES shows that ORDERS belongs to LAB_B. The target has to be written as lab_b.orders.

Fixrun as lab_a
CREATE SYNONYM orders FOR lab_b.orders;
OUTPUT
Synonym created.

With the owner prefix (FOR lab_b.orders) the synonym is created and SELECT ... FROM orders returns the row from LAB_B.

After the fixrun as lab_a
SELECT order_id, amount FROM orders;
✓ SUCCESS
  ORDER_ID     AMOUNT
---------- ----------
         1        100

1 row selected.

02Script run as the table owner instead of the application user

The statement CREATE SYNONYM orders FOR lab_b.orders is correct, but it was run while connected as LAB_B. A private synonym is created in the schema that runs it, so it would become LAB_B.ORDERS, the table itself.

Setup
Setuprun as lab_b
CREATE TABLE orders (order_id NUMBER PRIMARY KEY, amount NUMBER);
INSERT INTO orders VALUES (1, 100);
COMMIT;
GRANT SELECT ON orders TO lab_a;
OUTPUT
Table created.


1 row created.


Commit complete.


Grant succeeded.
Reproducerun as lab_b
CREATE SYNONYM orders FOR lab_b.orders;
✕ ERROR
CREATE SYNONYM orders FOR lab_b.orders
*
ERROR at line 1:
ORA-01471: cannot create a synonym with same name as object
Help: https://docs.oracle.com/error-help/db/ora-01471/
Check the causerun as lab_b
COLUMN object_name FORMAT A10
SELECT object_name, object_type FROM user_objects WHERE object_name = 'ORDERS';
OUTPUT
OBJECT_NAM OBJECT_TYPE
---------- ------------------------------
ORDERS     TABLE

1 row selected.

In LAB_B, USER_OBJECTS already has ORDERS as a TABLE. The synonym cannot take that name in the same schema.

Fixrun as lab_a
CREATE SYNONYM orders FOR lab_b.orders;
OUTPUT
Synonym created.

Run the same statement as LAB_A, the user who reads the table. USER_SYNONYMS then shows ORDERS → LAB_B.ORDERS.

After the fixrun as lab_a
COLUMN synonym_name FORMAT A12
COLUMN table_owner FORMAT A12
COLUMN table_name FORMAT A10
SELECT synonym_name, table_owner, table_name FROM user_synonyms;
SELECT order_id, amount FROM orders;
✓ SUCCESS
SYNONYM_NAME TABLE_OWNER  TABLE_NAME
------------ ------------ ----------
ORDERS       LAB_B        ORDERS

1 row selected.


  ORDER_ID     AMOUNT
---------- ----------
         1        100

1 row selected.

FAQ

What does ORA-01471 mean?

The synonym you are creating has the same owner and name as the object it refers to. Usually the owner prefix is missing, or the script is running in the table owner's schema.

How is ORA-01471 different from ORA-00955?

ORA-01471 means the synonym would point to itself. ORA-00955 means another object in the same schema already uses the name.

Which user should run CREATE SYNONYM for another schema's table?

The user who will query through the synonym, with the owner in the target: CREATE SYNONYM orders FOR lab_b.orders; run as LAB_A. The owner also has to grant access (GRANT SELECT ON orders TO lab_a).

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0