Looping chain of synonyms ошибка

I’m familiar with the issue behind ORA-01775: looping chain of synonyms, but is there any trick to debugging it, or do I just have to «create or replace» my way out of it?

Is there a way to query the schema or whatever to find out what the current definition of a public synonym is?

Even more awesome would be a graphical tool, but at this point, anything would be helpful.

kennytm's user avatar

kennytm

511k107 gold badges1086 silver badges1005 bronze badges

asked Oct 29, 2008 at 14:50

Josh Kodroff's user avatar

Josh KodroffJosh Kodroff

27.3k27 gold badges95 silver badges148 bronze badges

As it turns out, the problem wasn’t actually a looping chain of synonyms, but the fact that the synonym was pointing to a view that did not exist.

Oracle apparently errors out as a looping chain in this condition.

answered Oct 29, 2008 at 17:09

Josh Kodroff's user avatar

Josh KodroffJosh Kodroff

27.3k27 gold badges95 silver badges148 bronze badges

7

If you are using TOAD, go to View>Toad Options>Oracle>General and remove TOAD_PLAN_TABLE from EXPLAIN PLAN section and put PLAN_TABLE

answered Apr 19, 2013 at 5:26

LJT's user avatar

2

The data dictionary table DBA_SYNONYMS has information about all the synonyms in a database. So you can run the query

SELECT table_owner, table_name, db_link
  FROM dba_synonyms 
 WHERE owner        = 'PUBLIC'
   AND synonym_name = <<synonym name>>

to see what the public synonym currently points at.

answered Oct 29, 2008 at 15:11

Justin Cave's user avatar

Justin CaveJustin Cave

228k24 gold badges368 silver badges384 bronze badges

2

The less intuitive solution to this error code seems to be problems with the objects that the synonym is pointing to.

Here is my SQL for finding synonyms that point to erroneous objects.

SELECT S.OWNER as SYN_OWNER, S.SYNONYM_NAME as SYN_NAME,
    S.TABLE_OWNER as OBJ_OWNER, S.TABLE_NAME as OBJ_NAME,
    CASE WHEN O.OWNER is null THEN 'MISSING' ELSE O.STATUS END as OBJ_STATUS
FROM DBA_SYNONYMS S
    LEFT JOIN DBA_OBJECTS O ON S.TABLE_OWNER = O.OWNER AND S.TABLE_NAME = O.OBJECT_NAME
WHERE O.OWNER is null
    OR O.STATUS != 'VALID';

answered Aug 1, 2015 at 8:34

Jarrod Chesney's user avatar

4

Try this select to find the problematic synonyms, it lists all synonyms that are pointing to an object that does not exist (tables,views,sequences,packages, procedures, functions)

SELECT *
FROM dba_synonyms
WHERE table_owner = 'USER'
    AND (
        NOT EXISTS (
            SELECT *
            FROM dba_tables
            WHERE dba_synonyms.table_name = dba_tables.TABLE_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_views
            WHERE dba_synonyms.table_name = dba_views.VIEW_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_sequences
            WHERE dba_synonyms.table_name = dba_sequences.sequence_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_dependencies
            WHERE type IN (
                    'PACKAGE'
                    ,'PROCEDURE'
                    ,'FUNCTION'
                    )
                AND dba_synonyms.table_name = dba_dependencies.NAME
            )
        )

answered Oct 9, 2014 at 11:07

Michal Mikolajczyk's user avatar

2

Today I got this error, and after debugging I figured out that the actual tables were misssing, which I was referring using synonyms. So I suggest — first check that whether the tables exists!! :-))

answered Feb 18, 2010 at 7:11

Alan's user avatar

1

Step 1) See what Objects exist with the name:

select * from all_objects where object_name = upper('&object_name');

It could be that a Synonym exists but no Table?


Step 2) If that’s not the problem, investigate the Synonym:

select * from all_synonyms where synonym_name = upper('&synonym_name');

It could be that an underlying Table or View to that Synonym is missing?

answered Aug 7, 2014 at 16:20

grokster's user avatar

grokstergrokster

5,9391 gold badge36 silver badges22 bronze badges

1

A developer accidentally wrote code that generated and ran the following SQL statement CREATE OR REPLACE PUBLIC SYNONYM "DUAL" FOR "DUAL"; which caused select * from dba_synonyms where table_name = 'DUAL';
to return PUBLIC DUAL SOME_USER DUAL rather than PUBLIC DUAL SYS DUAL.

We were able to fix it (thanks to How to recreate public synonym «DUAL»?) by running

ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=FALSE SCOPE=MEMORY;
CREATE OR REPLACE PUBLIC SYNONYM DUAL FOR SYS.DUAL;
ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=true SCOPE=MEMORY;

Community's user avatar

answered Aug 24, 2015 at 20:36

Tim Lewis's user avatar

Tim LewisTim Lewis

3,3351 gold badge36 silver badges26 bronze badges

While Jarrod’s answer is a good idea, and catches a broader range of related problems, I found this query found in Oracle forums to more directly address the (originally stated) issue:

select owner, synonym_name, connect_by_iscycle CYCLE
from dba_synonyms
where connect_by_iscycle > 0
connect by nocycle prior table_name = synonym_name
and prior table_owner = owner
union
select 'PUBLIC', synonym_name, 1
from dba_synonyms
where owner = 'PUBLIC'
and table_name = synonym_name
and (table_name, table_owner) not in (select object_name, owner from dba_objects
where object_type != 'SYNONYM')

https://community.oracle.com/message/4176300#4176300

You will not have to wade through other kinds of invalid objects. Just those that are actually in endless loops.

answered Jun 26, 2018 at 16:13

Justin's user avatar

JustinJustin

3977 silver badges17 bronze badges

I had a similar problem, which turned out to be caused by missing double quotes off the table and schema name.

answered Feb 16, 2010 at 16:20

Jamie Kitson's user avatar

Jamie KitsonJamie Kitson

3,9934 gold badges37 silver badges50 bronze badges

We had the same ORA-01775 error but in our case, the schema user was missing some ‘grant select’ on a couple of the public synonyms.

answered Mar 13, 2013 at 18:48

Guy's user avatar

We encountered this error today.
This is how we debugged and fixed it.

  1. Package went to invalid state due to this error ORA-01775.

  2. With the error line number , We went thru the package body code and found the code which was trying to insert data into a table.

  3. We ran below queries to check if the above table and synonym exists.

    SELECT * FROM DBA_TABLES WHERE TABLE_NAME = '&TABLE_NAME';  -- No rows returned
    
    SELECT * FROM DBA_SYNONYMS WHERE SYNONYM_NAME = '&SYNONYM_NAME'; -- 1 row returned
    
  4. With this we concluded that the table needs to be re- created. As the synonym was pointing to a table that did not exist.

  5. DBA team re-created the table and this fixed the issue.

answered Mar 18, 2016 at 20:59

mahi_0707's user avatar

mahi_0707mahi_0707

1,0309 silver badges17 bronze badges

ORA-01775: looping chain of synonyms
I faced the above error while I was trying to compile a Package which was using an object for which synonym was created however underlying object was not available.

answered Jul 21, 2011 at 12:27

Nitin Guru's user avatar

I’m using the following sql to find entries in all_synonyms where there is no corresponding object for the object_name (in user_objects):

 select * 
   from all_synonyms 
   where table_owner = 'SCOTT' 
     and synonym_name not like '%/%'
     and table_name not in (
       select object_name from user_objects
         where object_type in (
           'TABLE', 'VIEW', 'PACKAGE', 'SEQUENCE',
           'PROCEDURE', 'FUNCTION', 'TYPE'
         )
    );

answered Apr 21, 2016 at 13:05

wmorrison365's user avatar

wmorrison365wmorrison365

5,9952 gold badges27 silver badges40 bronze badges

http://ora-01775.ora-code.com/ suggests:

ORA-01775: looping chain of synonyms
Cause: Through a series of CREATE synonym statements, a synonym was defined that referred to itself. For example, the following definitions are circular:
CREATE SYNONYM s1 for s2 CREATE SYNONYM s2 for s3 CREATE SYNONYM s3 for s1
Action: Change one synonym definition so that it applies to a base table or view and retry the operation.

answered Oct 29, 2008 at 15:12

warren's user avatar

warrenwarren

32.7k21 gold badges86 silver badges124 bronze badges

3

If you are compiling a PROCEDURE, possibly this is referring to a table or view that does not exist as it is created in the same PROCEDURE. In this case the solution is to make the query declared as String eg v_query: = 'insert into table select * from table2 and then execute immediate on v_query;

This is because the compiler does not yet recognize the object and therefore does not find the reference. Greetings.

JoelC's user avatar

JoelC

3,6649 gold badges33 silver badges38 bronze badges

answered Mar 4, 2015 at 17:45

Faxon Lander Montenegro's user avatar

I had a function defined in the wrong schema and without a public synonym. I.e. my proc was in schema «Dogs» and the function was in schema «Cats». The function didn’t have a public synonym on it to allow Dogs to access the cats’ function.

answered Jan 31, 2017 at 13:52

Nick's user avatar

NickNick

8822 gold badges9 silver badges31 bronze badges

For me, the table name and the synonym both existed but under different owner names. I re-created the tables under the owner name that matched the owner name in synonyms.

I used the queries posted by @Mahi_0707

answered Jan 18, 2019 at 15:35

Kalyani Singh's user avatar

I’m familiar with the issue behind ORA-01775: looping chain of synonyms, but is there any trick to debugging it, or do I just have to «create or replace» my way out of it?

Is there a way to query the schema or whatever to find out what the current definition of a public synonym is?

Even more awesome would be a graphical tool, but at this point, anything would be helpful.

kennytm's user avatar

kennytm

511k107 gold badges1086 silver badges1005 bronze badges

asked Oct 29, 2008 at 14:50

Josh Kodroff's user avatar

Josh KodroffJosh Kodroff

27.3k27 gold badges95 silver badges148 bronze badges

As it turns out, the problem wasn’t actually a looping chain of synonyms, but the fact that the synonym was pointing to a view that did not exist.

Oracle apparently errors out as a looping chain in this condition.

answered Oct 29, 2008 at 17:09

Josh Kodroff's user avatar

Josh KodroffJosh Kodroff

27.3k27 gold badges95 silver badges148 bronze badges

7

If you are using TOAD, go to View>Toad Options>Oracle>General and remove TOAD_PLAN_TABLE from EXPLAIN PLAN section and put PLAN_TABLE

answered Apr 19, 2013 at 5:26

LJT's user avatar

2

The data dictionary table DBA_SYNONYMS has information about all the synonyms in a database. So you can run the query

SELECT table_owner, table_name, db_link
  FROM dba_synonyms 
 WHERE owner        = 'PUBLIC'
   AND synonym_name = <<synonym name>>

to see what the public synonym currently points at.

answered Oct 29, 2008 at 15:11

Justin Cave's user avatar

Justin CaveJustin Cave

228k24 gold badges368 silver badges384 bronze badges

2

The less intuitive solution to this error code seems to be problems with the objects that the synonym is pointing to.

Here is my SQL for finding synonyms that point to erroneous objects.

SELECT S.OWNER as SYN_OWNER, S.SYNONYM_NAME as SYN_NAME,
    S.TABLE_OWNER as OBJ_OWNER, S.TABLE_NAME as OBJ_NAME,
    CASE WHEN O.OWNER is null THEN 'MISSING' ELSE O.STATUS END as OBJ_STATUS
FROM DBA_SYNONYMS S
    LEFT JOIN DBA_OBJECTS O ON S.TABLE_OWNER = O.OWNER AND S.TABLE_NAME = O.OBJECT_NAME
WHERE O.OWNER is null
    OR O.STATUS != 'VALID';

answered Aug 1, 2015 at 8:34

Jarrod Chesney's user avatar

4

Try this select to find the problematic synonyms, it lists all synonyms that are pointing to an object that does not exist (tables,views,sequences,packages, procedures, functions)

SELECT *
FROM dba_synonyms
WHERE table_owner = 'USER'
    AND (
        NOT EXISTS (
            SELECT *
            FROM dba_tables
            WHERE dba_synonyms.table_name = dba_tables.TABLE_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_views
            WHERE dba_synonyms.table_name = dba_views.VIEW_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_sequences
            WHERE dba_synonyms.table_name = dba_sequences.sequence_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_dependencies
            WHERE type IN (
                    'PACKAGE'
                    ,'PROCEDURE'
                    ,'FUNCTION'
                    )
                AND dba_synonyms.table_name = dba_dependencies.NAME
            )
        )

answered Oct 9, 2014 at 11:07

Michal Mikolajczyk's user avatar

2

Today I got this error, and after debugging I figured out that the actual tables were misssing, which I was referring using synonyms. So I suggest — first check that whether the tables exists!! :-))

answered Feb 18, 2010 at 7:11

Alan's user avatar

1

Step 1) See what Objects exist with the name:

select * from all_objects where object_name = upper('&object_name');

It could be that a Synonym exists but no Table?


Step 2) If that’s not the problem, investigate the Synonym:

select * from all_synonyms where synonym_name = upper('&synonym_name');

It could be that an underlying Table or View to that Synonym is missing?

answered Aug 7, 2014 at 16:20

grokster's user avatar

grokstergrokster

5,9391 gold badge36 silver badges22 bronze badges

1

A developer accidentally wrote code that generated and ran the following SQL statement CREATE OR REPLACE PUBLIC SYNONYM "DUAL" FOR "DUAL"; which caused select * from dba_synonyms where table_name = 'DUAL';
to return PUBLIC DUAL SOME_USER DUAL rather than PUBLIC DUAL SYS DUAL.

We were able to fix it (thanks to How to recreate public synonym «DUAL»?) by running

ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=FALSE SCOPE=MEMORY;
CREATE OR REPLACE PUBLIC SYNONYM DUAL FOR SYS.DUAL;
ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=true SCOPE=MEMORY;

Community's user avatar

answered Aug 24, 2015 at 20:36

Tim Lewis's user avatar

Tim LewisTim Lewis

3,3351 gold badge36 silver badges26 bronze badges

While Jarrod’s answer is a good idea, and catches a broader range of related problems, I found this query found in Oracle forums to more directly address the (originally stated) issue:

select owner, synonym_name, connect_by_iscycle CYCLE
from dba_synonyms
where connect_by_iscycle > 0
connect by nocycle prior table_name = synonym_name
and prior table_owner = owner
union
select 'PUBLIC', synonym_name, 1
from dba_synonyms
where owner = 'PUBLIC'
and table_name = synonym_name
and (table_name, table_owner) not in (select object_name, owner from dba_objects
where object_type != 'SYNONYM')

https://community.oracle.com/message/4176300#4176300

You will not have to wade through other kinds of invalid objects. Just those that are actually in endless loops.

answered Jun 26, 2018 at 16:13

Justin's user avatar

JustinJustin

3977 silver badges17 bronze badges

I had a similar problem, which turned out to be caused by missing double quotes off the table and schema name.

answered Feb 16, 2010 at 16:20

Jamie Kitson's user avatar

Jamie KitsonJamie Kitson

3,9934 gold badges37 silver badges50 bronze badges

We had the same ORA-01775 error but in our case, the schema user was missing some ‘grant select’ on a couple of the public synonyms.

answered Mar 13, 2013 at 18:48

Guy's user avatar

We encountered this error today.
This is how we debugged and fixed it.

  1. Package went to invalid state due to this error ORA-01775.

  2. With the error line number , We went thru the package body code and found the code which was trying to insert data into a table.

  3. We ran below queries to check if the above table and synonym exists.

    SELECT * FROM DBA_TABLES WHERE TABLE_NAME = '&TABLE_NAME';  -- No rows returned
    
    SELECT * FROM DBA_SYNONYMS WHERE SYNONYM_NAME = '&SYNONYM_NAME'; -- 1 row returned
    
  4. With this we concluded that the table needs to be re- created. As the synonym was pointing to a table that did not exist.

  5. DBA team re-created the table and this fixed the issue.

answered Mar 18, 2016 at 20:59

mahi_0707's user avatar

mahi_0707mahi_0707

1,0309 silver badges17 bronze badges

ORA-01775: looping chain of synonyms
I faced the above error while I was trying to compile a Package which was using an object for which synonym was created however underlying object was not available.

answered Jul 21, 2011 at 12:27

Nitin Guru's user avatar

I’m using the following sql to find entries in all_synonyms where there is no corresponding object for the object_name (in user_objects):

 select * 
   from all_synonyms 
   where table_owner = 'SCOTT' 
     and synonym_name not like '%/%'
     and table_name not in (
       select object_name from user_objects
         where object_type in (
           'TABLE', 'VIEW', 'PACKAGE', 'SEQUENCE',
           'PROCEDURE', 'FUNCTION', 'TYPE'
         )
    );

answered Apr 21, 2016 at 13:05

wmorrison365's user avatar

wmorrison365wmorrison365

5,9952 gold badges27 silver badges40 bronze badges

http://ora-01775.ora-code.com/ suggests:

ORA-01775: looping chain of synonyms
Cause: Through a series of CREATE synonym statements, a synonym was defined that referred to itself. For example, the following definitions are circular:
CREATE SYNONYM s1 for s2 CREATE SYNONYM s2 for s3 CREATE SYNONYM s3 for s1
Action: Change one synonym definition so that it applies to a base table or view and retry the operation.

answered Oct 29, 2008 at 15:12

warren's user avatar

warrenwarren

32.7k21 gold badges86 silver badges124 bronze badges

3

If you are compiling a PROCEDURE, possibly this is referring to a table or view that does not exist as it is created in the same PROCEDURE. In this case the solution is to make the query declared as String eg v_query: = 'insert into table select * from table2 and then execute immediate on v_query;

This is because the compiler does not yet recognize the object and therefore does not find the reference. Greetings.

JoelC's user avatar

JoelC

3,6649 gold badges33 silver badges38 bronze badges

answered Mar 4, 2015 at 17:45

Faxon Lander Montenegro's user avatar

I had a function defined in the wrong schema and without a public synonym. I.e. my proc was in schema «Dogs» and the function was in schema «Cats». The function didn’t have a public synonym on it to allow Dogs to access the cats’ function.

answered Jan 31, 2017 at 13:52

Nick's user avatar

NickNick

8822 gold badges9 silver badges31 bronze badges

For me, the table name and the synonym both existed but under different owner names. I re-created the tables under the owner name that matched the owner name in synonyms.

I used the queries posted by @Mahi_0707

answered Jan 18, 2019 at 15:35

Kalyani Singh's user avatar

18 ответов

Как оказалось, проблема не была фактически цепной цепочкой синонимов, а тем фактом, что синоним указывал на представление, которого не было.

Oracle, по-видимому, ошибочно считается цепочкой циклов в этом состоянии.

Josh Kodroff

Поделиться

Если вы используете TOAD, перейдите в меню «Вид» > «Параметры жабы» > «Oracle» > «Общие» и удалите TOAD_PLAN_TABLE из раздела PLAY_TABLE и поставьте PLAN_TABLE

LJT

Поделиться

Таблица словаря данных DBA_SYNONYMS содержит информацию обо всех синонимах в базе данных. Таким образом, вы можете запустить запрос

SELECT table_owner, table_name, db_link
  FROM dba_synonyms 
 WHERE owner        = 'PUBLIC'
   AND synonym_name = <<synonym name>>

чтобы увидеть, что на данный момент указывает публичный синоним.

Justin Cave

Поделиться

Менее интуитивно понятное решение этого кода ошибки, похоже, является проблемой с объектами, на которые указывает синоним.

Вот мой SQL для нахождения синонимов, указывающих на ошибочные объекты.

SELECT S.OWNER as SYN_OWNER, S.SYNONYM_NAME as SYN_NAME,
    S.TABLE_OWNER as OBJ_OWNER, S.TABLE_NAME as OBJ_NAME,
    CASE WHEN O.OWNER is null THEN 'MISSING' ELSE O.STATUS END as OBJ_STATUS
FROM DBA_SYNONYMS S
    LEFT JOIN DBA_OBJECTS O ON S.TABLE_OWNER = O.OWNER AND S.TABLE_NAME = O.OBJECT_NAME
WHERE O.OWNER is null
    OR O.STATUS != 'VALID';

Jarrod Chesney

Поделиться

Попробуйте этот выбор, чтобы найти проблемные синонимы, в нем перечислены все синонимы, указывающие на объект, который не существует (таблицы, представления, последовательности, пакеты, процедуры, функции)

SELECT *
FROM dba_synonyms
WHERE table_owner = 'SYSADM'
    AND (
        NOT EXISTS (
            SELECT *
            FROM dba_tables
            WHERE dba_synonyms.table_name = dba_tables.TABLE_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_views
            WHERE dba_synonyms.table_name = dba_views.VIEW_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_sequences
            WHERE dba_synonyms.table_name = dba_sequences.sequence_NAME
            )
        AND NOT EXISTS (
            SELECT *
            FROM dba_dependencies
            WHERE type IN (
                    'PACKAGE'
                    ,'PROCEDURE'
                    ,'FUNCTION'
                    )
                AND dba_synonyms.table_name = dba_dependencies.NAME
            )
        )

Michal Mikolajczyk

Поделиться

Сегодня я получил эту ошибку, и после отладки я понял, что фактические таблицы были пропущены, и я ссылался на синонимы. Поэтому я предлагаю — сначала проверьте, существуют ли таблицы!: -))

Alan

Поделиться

Разработчик случайно написал код, который сгенерировал и выполнил следующий оператор SQL CREATE OR REPLACE PUBLIC SYNONYM "DUAL" FOR "DUAL";, из-за которого select * from dba_synonyms where table_name = 'DUAL';
возвращал PUBLIC DUAL SOME_USER DUAL, а не PUBLIC DUAL SYS DUAL.

Мы смогли это исправить (спасибо Как воссоздать общедоступный синоним «DUAL» ,), запустив

ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=FALSE SCOPE=MEMORY;
CREATE OR REPLACE PUBLIC SYNONYM DUAL FOR SYS.DUAL;
ALTER SYSTEM SET "_SYSTEM_TRIG_ENABLED"=true SCOPE=MEMORY;

Tim Lewis

Поделиться

Сегодня мы столкнулись с этой ошибкой.
Вот как мы отлаживали и исправляли его.

  • Пакет перешел в недопустимое состояние из-за этой ошибки ORA-01775.

  • С номером строки ошибки мы прошли через код тела package и нашли код, который пытался вставить данные в table.

  • Мы выполнили ниже запросов, чтобы проверить, существуют ли выше table и synonym.

    SELECT * FROM DBA_TABLES WHERE TABLE_NAME = '&TABLE_NAME';  -- No rows returned
    
    SELECT * FROM DBA_SYNONYMS WHERE SYNONYM_NAME = '&SYNONYM_NAME'; -- 1 row returned
    
  • С этим мы пришли к выводу, что таблицу необходимо восстановить. Поскольку synonym указывал на table, который не существовал.

  • Команда DBA повторно создала таблицу, и это устранило проблему.

Mahi_0707

Поделиться

Шаг 1) Посмотрите, какие объекты существуют с именем:

select * from all_objects where object_name = upper('&object_name');

Может быть, синоним существует, но нет таблицы?


Шаг 2) Если это не проблема, изучите синоним:

select * from all_synonyms where synonym_name = upper('&synonym_name');

Может быть, отсутствует базовая таблица или вид этого синонима?

grokster

Поделиться

У нас была такая же ошибка ORA-01775, но в нашем случае пользователю схемы не хватало некоторого «выбора гранта» на пару общих синонимов.

Guy

Поделиться

У меня была аналогичная проблема, которая, как оказалось, была вызвана отсутствием двойных кавычек из таблицы и имени схемы.

Jamie Kitson

Поделиться

Для меня имя таблицы и синоним существовали, но под разными именами владельцев. Я заново создал таблицы под именем владельца, которые совпадают с именем владельца в синонимах.

Я использовал запросы, отправленные @Mahi_0707

Kalyani Singh

Поделиться

Хотя ответ Джаррода является хорошей идеей и охватывает более широкий круг связанных проблем, я обнаружил, что этот запрос был найден на форумах Oracle для более непосредственного решения (первоначально заявленной) проблемы:

select owner, synonym_name, connect_by_iscycle CYCLE
from dba_synonyms
where connect_by_iscycle > 0
connect by nocycle prior table_name = synonym_name
and prior table_owner = owner
union
select 'PUBLIC', synonym_name, 1
from dba_synonyms
where owner = 'PUBLIC'
and table_name = synonym_name
and (table_name, table_owner) not in (select object_name, owner from dba_objects
where object_type != 'SYNONYM')

https://community.oracle.com/message/4176300#4176300

Вам не придется пробираться через другие виды недопустимых объектов. Просто те, которые на самом деле в бесконечных петлях.

Justin

Поделиться

Я использую следующий sql для поиска записей в all_synonyms, где нет соответствующего объекта для object_name (в user_objects):

 select * 
   from all_synonyms 
   where table_owner = 'SCOTT' 
     and synonym_name not like '%/%'
     and table_name not in (
       select object_name from user_objects
         where object_type in (
           'TABLE', 'VIEW', 'PACKAGE', 'SEQUENCE',
           'PROCEDURE', 'FUNCTION', 'TYPE'
         )
    );

wmorrison365

Поделиться

Если вы компилируете ПРОЦЕДУРУ, возможно, это относится к таблице или представлению, которая не существует, поскольку она создана в той же ПРОЦЕДУРЕ. В этом случае решение должно сделать запрос объявленным как String, например v_query: = 'insert into table select * from table2, а затем выполнить немедленное на v_query;

Это связано с тем, что компилятор еще не распознает объект и поэтому не находит ссылку. Привет.

Faxon

Поделиться

ORA-01775: циклическая цепочка синонимов
Я столкнулся с вышеуказанной ошибкой, когда я пытался скомпилировать пакет, который использовал объект, для которого был создан синоним, но базовый объект недоступен.

Nitin Guru

Поделиться

http://ora-01775.ora-code.com/ предлагает:

ORA-01775: циклическая цепочка синонимов
Причина. Через серию операторов синонимов CREATE был определен синоним, который ссылался на себя. Например, следующие определения являются круговыми:
CREATE SYNONYM s1 for s2 CREATE SYNONYM s2 for s3 CREATE SYNONYM s3 for s1
Действие: измените одно определение синонима, чтобы оно применимо к базовой таблице или представлению и повторите операцию.

warren

Поделиться

У меня была функция, определенная в неправильной схеме и без публичного синонима. То есть мой proc был в схеме «Собаки», и функция была в схеме «Кошки». У функции не было открытого синонима, чтобы позволить Собакам получить доступ к функции кошек.

Nicholas V.

Поделиться

Ещё вопросы

  • 1Удалить текст из счетчика
  • 0MySQL: извлечение значения регулярного выражения из запроса
  • 1CMIS session.queryObjects не возвращает аспекты
  • 0varchar m: d: YH: i: s для преобразования формата даты и времени в mysql
  • 0«Введите ошибку: слишком мало аргументов для функции App \ Http \ Controllers \ FrontController :: detail (), 0 передано и ожидается ровно 1»
  • 1Как использовать модуль Python Mobilenium с селеном
  • 1Большие проблемы с памятью матрицы
  • 0Создать меню с двумя подменю
  • 0почему изображение не занимает полную ширину в%?
  • 1Лучший способ хранить данные временно?
  • 1Как добавить ‘|’ Трубка в каждой ячейке в конце слова в моем листе Excel с использованием Python
  • 0Проблемы с круговыми диаграммами jqplot
  • 1Как перебрать списки из pandas dataframe в функции
  • 0Почему создание этого представления вызывает ошибку 1350, когда SQL правильно работает на вкладке SQL?
  • 1Android Design: Intentservice вызывает приложение не отвечает
  • 1Почему каждое исключение является системным исключением?
  • 0(Javascript) Как добавить таймер обратного отсчета к опции выбора
  • 1Итеративный объект ассоциативного массива
  • 0Jquery — возвращение значения из массива
  • 1неизменяемая карта, добавление одного объекта является синтаксической ошибкой, 2 в порядке
  • 0Изменить функцию, чтобы использовать класс HTML вместо идентификатора
  • 0Проблемы с прототипированием структуры (неправильное использование неопределенного типа) c ++
  • 1Интерфейс наследования интерфейса
  • 1Проблема, связанная с вложенным hashmap
  • 1Написать ключ для разделения CSV на основе значения в словаре
  • 0Как активировать состояние и передать объект в новый вид?
  • 1Android загружает значения из файла строк по умолчанию (strings.xml) после изменения локали во второй раз
  • 1Ограничить количество текста, выводимого с помощью Meteor Blaze
  • 1Как добавить поле на «plotLines text» Highcharts
  • 0Можем ли мы использовать Qt (64) для создания приложения, которое будет работать как на 32-битных, так и на 64-битных окнах?
  • 0Проблемы с выпадающим списком навигации по CSS
  • 0Ссылки работают в браузере, но не работают в iPad
  • 1Как убрать выделение синего цвета выделенным элементом в listBox1 при нажатии на элемент? [Дубликат]
  • 0Почему мой процесс останавливается при запуске в фоновом режиме?
  • 1Python / Flask-WTF — Как я могу рандомизировать выбор из динамического RadioField?
  • 0Где мне нужно развернуть файлы приложения после входа в openshift с помощью filezila
  • 1Несколько графиков на одной странице, ошибка масштаба в D3.js
  • 1Python — ускорить итерацию панд
  • 0Как проверить, если сегодняшняя дата = дата из sql?
  • 1Как мне искать, если значение находится внутри фрейма данных
  • 1Как программно изменить изображение-макет пользовательского предпочтения?
  • 1сбой приложения при добавлении google login firebaseui
  • 1ввод заменить символы при наборе текста?
  • 1Получить данные из обратных вызовов
  • 1Как отложить вызов в базу данных от gwt?
  • 0jQuery, как отключить функцию щелчка для строки при нажатии на первый элемент TD?
  • 1Чтение цифрового и аналогового ввода на Raspberry Pi 3 с использованием Python
  • 1Каковы лучшие практики для написания модульных тестов с помощью фреймворков
  • 0Как мне сопоставить динамический маршрут в базе данных?
  • 1Как реализовать OnClickListener в RecyclerView?

I am creating a table (here below is the code) — this is executed through some script on unix. The script also creates some synonyms (not sure what/how):

drop table BNS_SAA_MESSAGES;
CREATE TABLE BNS_SAA_MESSAGES
(
HostNumber varchar(50) NOT NULL,
SAAMessage varchar(2048) NOT NULL,
PRIMARY KEY (HostNumber)
);

I’m getting the following error:

Processing bns_saa_messages
cat: cannot open bns_saa_messages.sql

Commit complete.

GRANT SELECT ON bns_saa_messages TO RL_ORDFX_RPT

GRANT SELECT ON bns_saa_messages TO RL_ORDFX_RPT
                *
ERROR at line 1:
ORA-01775: looping chain of synonyms


GRANT INSERT ON bns_saa_messages TO RL_ORDFX_RPT

GRANT INSERT ON bns_saa_messages TO RL_ORDFX_RPT
                *
ERROR at line 1:
ORA-01775: looping chain of synonyms


GRANT UPDATE ON bns_saa_messages TO RL_ORDFX_RPT

GRANT UPDATE ON bns_saa_messages TO RL_ORDFX_RPT
                *
ERROR at line 1:
ORA-01775: looping chain of synonyms


GRANT DELETE ON bns_saa_messages TO RL_ORDFX_RPT

GRANT DELETE ON bns_saa_messages TO RL_ORDFX_RPT
                *
ERROR at line 1:
ORA-01775: looping chain of synonyms


create public synonym bns_saa_messages for ORDMSO.bns_saa_messages

create public synonym bns_saa_messages for ORDMSO.bns_saa_messages
                      *
ERROR at line 1:
ORA-00955: name is already used by an existing object



Commit complete.

I googled for ORA-01775: looping chain of synonyms and it seems to mean that a something was removed but there is a pointer to it. I’m guessing it happens during select from ‘things’ that do not exist anymore. Not sure if these things are tables or something else. This is what I gathered from my research.

Any idea how to create my tables? I tried to execute multiple times the SQL code, but to no avail — I get the same error every time.

Also the table is not created:

SQL> select * from bns_saa_messages;
select * from bns_saa_messages
              *
ERROR at line 1:
ORA-01775: looping chain of synonyms

I’ve looked at the following so questions, but it doesn’t seem to be helping. Maybe you can see something I don’t:
I get an ORA-01775: looping chain of synonyms error when I use sqlldr
How to debug ORA-01775: looping chain of synonyms?
ORA-01775: looping chain of synonyms but there are no synonyms

Thanks

:UPDATE:

After executing: select * from all_synonyms where synonym_name = 'BNS_SAA_MESSAGES'; as per Craig’s suggestion I get:

OWNER                          SYNONYM_NAME
------------------------------ ------------------------------
TABLE_OWNER                    TABLE_NAME
------------------------------ ------------------------------
DB_LINK
--------------------------------------------------------------------------------
PUBLIC                         BNS_SAA_MESSAGES
ORDMSO                         BNS_SAA_MESSAGES

:UPDATE: 2
Running: select * from all_tables where table_name = 'BNS_SAA_MESSAGES';

SQL> select * from all_tables where table_name = 'BNS_SAA_MESSAGES';

no rows selected

Oracle Looping Chain of Synonyms

So I encounter the looping chain of synonyms error every once in a while and it seems pretty simple to understand, though I thought I would take a minute to demonstrate how it works.

ORA-01775: looping chain of synonyms – Basically means that you created a synonym that points to another object in a circle.

Here is an example that would cause the error:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create synonym s1 for s2;
Synonym created.
SQL> create synonym s2 for s3;
Synonym created.
SQL> create synonym s3 for s1;
Synonym created.
SQL> select * from s1;
select * from s1
*
ERROR at line 1:
ORA-01775: looping chain of synonyms
SQL> select * from s2;
select * from s2
*
ERROR at line 1:
ORA-01775: looping chain of synonyms
SQL> select * from s3;
select * from s3
*
ERROR at line 1:
ORA-01775: looping chain of synonyms

In order to fix the above problem you need to have one of the synonyms in the chain point to an object like below.

SQL> drop synonym s3;

Synonym dropped.

SQL> create table table1(col1 char(1));

Table created.

SQL> create synonym s3 for table1;

Synonym created.

SQL> select * from s1;

no rows selected

SQL> select * from s2;

no rows selected

SQL> select * from s3;

no rows selected

As you can see the looping chain is now broken and all synonyms created will point to the object created and then pointed to by s3.

If the object was dropped or didn’t exist you would get a different error all together like so:

SQL> drop table table1;

Table dropped.

SQL> select * from s3;
select * from s3
*
ERROR at line 1:
ORA-00980: synonym translation is no longer valid
SQL> select * from s2;
select * from s2
*
ERROR at line 1:
ORA-00980: synonym translation is no longer valid
SQL> select * from s1;
select * from s1
*
ERROR at line 1:
ORA-00980: synonym translation is no longer valid

Obviously if the object is recreated it will fix the error reported above.

SQL> create table table1(col1 char(1));

Table created.

SQL> select * from s3;

no rows selected

SQL> select * from s1;

no rows selected

SQL> select * from s2;

no rows selected

With that said, I hope that this helps someone wrap their head around how this error presents itself. If you need more help get in touch with one of our experts DBA’s today!

Понравилась статья? Поделить с друзьями:
  • Looper java android ошибка
  • Lost alfa configurator ошибка
  • Loop without do ошибка vba
  • Lost alpha configuration произошла непредвиденная ошибка
  • Lookupvalue dax ошибка