1

I apologize for posting a question that seems to have been asked numerous times on the internet, but I can't quite fix it for some reason.

I was trying to populate some tables using Oracle's magical sqldr utility, but it throws an ORA-01775 error for some reason.

Everywhere I go on Google, people say something along the lines of: "Amateur, get your synonyms sorted out" (that was paraphrased) and that's nice and all, but I did not make any synonyms.

Here, the following does not work on my system:

SQLPLUS user/password
SQL>CREATE TABLE test (name varchar(10), id number);
SQL>exit

Then, I have a .ctl file with the following contents:

load data
    characterset utf16
    infile *
    append
    into table test
    (name,
     id
    )
    begindata
    "GURRR"  4567

Then I run this command:

sqlldr user@localhost/password control=/tmp/controlfiles/test.ctl

The result:

SQL*Loader-702: Internal error - ulndotvcol: OCIStmtExecute()
ORA-01775: looping chain of synonyms

Part of test.log:

Table TEST, loaded from every logical record.
Insert option in effect for this table: APPEND

Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
NAME                                FIRST     2           CHARACTER            
ID                                   NEXT     2           CHARACTER            

SQL*Loader-702: Internal error - ulndotvcol: OCIStmtExecute()
ORA-01775: looping chain of synonyms     

And, if I try to do a manual insert:

SQL> insert into test values ('aa', 56);
1 row created.

There is no problem.

So, yeah, I am stuck!

If it helps, I am using Oracle 11g XE on CentOS.

Thanks for the help guys, I appreciate it.

EDIT:

I kind of, sort of figured out part of the problem. The problem was that somewhere along the line, maybe during a failed load or something, Oracle had given itself corrupt views and synonyms.

The affected views were: GV_$LOADISTAT, GV_$LOADPSTAT, V_$LOADISTAT and V_$LOADPSTAT. I am not quite sure why the views got corrupt, but recompiling them resulted in compiled with errorserrors. The synonyms used in the queries themselves were corrupt, namely the gv$loadistat, gv$loadpstat, v$loadistat and v$loadpstat synonyms.

I wasn't sure about why this was happening and I didn't quite understand anything. So, I decided to drop the synonyms and recreate them. Unfortunately, I couldn't recreate them, as the view they pointed to (there is a bit of weird recursion going on here...) was corrupt. These views were the aforementioned GV_$LOADISTAT and other views. In other words, the synonyms pointed to the views that used those synonyms. Talk about a looping chain.

So...I recreated the public synonyms but instead of specifying the view as GV_$LOADISTAT, I specified them as sys.GV_$LOADISTAT. e.g.

DROP PUBLIC synonym GV$LOADISTAT;
CREATE PUBLIC synonym GV$LOADISTAT for sys.GV_$LOADISTAT;

Then, I recreated the user views to point to those public synonyms.

CREATE OR REPLACE FORCE VIEW "USER"."GV_$LOADISTAT" ("INST_ID", "OWNER", "TABNAME", "INDEXNAME", "SUBNAME", "MESSAGE_NUM", "MESSAGE")
 AS
 SELECT "INST_ID",
   "OWNER",
   "TABNAME",
   "INDEXNAME",
   "SUBNAME",
   "MESSAGE_NUM",
   "MESSAGE"
 FROM gv$loadistat;

That seemed to fix the views/synonyms. Yeah, it is a bit of a hack, but it somehow worked. Unfortunately, this was not enough to run SQL Loader. I got a table or view does not exist error.

I tried granting more permissions to my regular user, but it didn't work. So, I gave up and ran SQL Loader as sysdba. It worked! It is not a good thing to do, but it is a development only system made for testing purposes, so, I didn't care.

zermy
  • 611
  • 1
  • 11
  • 25

1 Answers1

1

I could not repeat your looping synonym chain error, but it appears the control file needed a bit of work, at least for my environment.

I was able to get your example to work by modifying it thusly:

load data
infile *
append
into table test
fields terminated by "," optionally enclosed by '"'
(name,
 id
)
begindata
"GURRR",4567
DCookie
  • 42,630
  • 11
  • 83
  • 92