Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Synonyms causing a strange problem-Solved.

Synonyms causing a strange problem-Solved.

From: James Damiano <jadam_at_nhes.state.nh.us>
Date: Wed, 19 Dec 2001 08:47:43 -0800
Message-ID: <F001.003E02DE.20011219075027@fatcity.com>

Greetings fellow DBAs:

I just dealt with a problem I personally haven't run into before and thought that members of this list might be interested in reviewing:

    "User-A" owns all of a set of objects on Database
"Primary-DB" including tables "Table-1" through "Table-100".

    "User-B" also exists on "Primary-DB", has no tables of its own, but has been granted read access to some of the User "A" tables, specifically tables "Table-1" through
"Table-9".

    A developer wants me to create and populate two tables in "User-B's" schema. Those tables are to be called exactly the same name and have pretty much the same data as two of the tables in "User-A's" schema, specifically "Table-6" and "Table-7". To accomplish this, he gives me an export from another database called "Secondary-DB" with just those two tables in it.

I try to import the two tables into "User-B's" schema on
"Primary-DB". The import fails and I get the message
"Table or view already exists". I'm surprised at this since
the "User-B" schema doesn't have any tables defined in it. To verify, I connect to the database as "User-B" and do a

    SQL> select table_name from user_tables;     SQL> No rows selected.

Result: There are indeed no tables in "User-B's" schema. Yet on attempting to import "Table-6" and "Table-7" into
"User-B's" schema, it tells me it can't do so because
those tables already exist!

    To make a long story short, the solution to this enigma is the following:

I came to find out that there had been a bunch of synonyms defined, among which were these two:

    SQL> create synonym User-B.Table-6 for User-A.Table-6;     SQL> create synonym User-B.Table-7 for User-A.Table-7;

so that when I tried to import "Table-6" and "Table-7" into
"User-B's" schema, the synonyms made Oracle think that
they already existed. I dropped the two offending synonyms:

    SQL> drop synonym User-B.Table-6;
    SQL> drop synonym User-B.Table-7;

after which the import worked just fine and all was well.

Just thought some of you out there might be interested...

Jim Damiano

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: James Damiano
  INET: jadam_at_nhes.state.nh.us

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Dec 19 2001 - 10:47:43 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US