?
Solved

Oracle 10g - Create synonym

Posted on 2014-09-16
7
Medium Priority
?
650 Views
Last Modified: 2014-09-17
Hi,

Im trying to create a synonym for a table in a dif. schema but I cant access the table even after the synonym creation...

When connected as dpow schema I can see the table:

sqlplus dpow/XXXXX

SQL> desc TS_DCS
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 DCS                                       NOT NULL NUMBER(3)
 VALID                                     NOT NULL NUMBER(1)

So when connected as dpow_1a I cant...

SQL> desc DPOW.TS_DCS
ERROR:
ORA-04043: object DPOW.TS_DCS does not exist

Even after creating this synonym as dpow_1a
CREATE SYNONYM TS_DCS FOR dpow.TS_DCS;
commit;

===

Am I doing anything wrong? Any permission that needs to be set?

Both schemas are in the same DB.

Tks,
Joa
0
Comment
Question by:joaotelles
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 14

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 40325307
I suppose, you have to "CREATE PUBLIC SYNONYM TS_DCS FOR DPOW.TS_DCS;" as user DPOW
Then you can do a "DESC TS_DCS" as DPOW_1A...
0
 
LVL 35

Accepted Solution

by:
johnsone earned 2000 total points
ID: 40325317
Do not create a public synonym.  If you want a private synonym, that is what you should create.  Public synonyms can create problems.  In this case, the public synonym would generate the same error anyway.

You error is a permission problem.  User DPOW_1A does not have permission on DPOW.TS_DCS.  If you grant permission (probably GRANT SELECT ON TS_DCS TO DPOW_1A as the DPOW user), then it should work fine.

The object does not exist message is a permission message in this case.  The idea is a security message, if it gives you a permission message, then you just guess a correct name of an object in another schema.
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 40326196
Johnsone is correct.  This is a permission (grant) problem, not a synonym problem.  Synonyms and permissions (grants) in Oracle are independent of each other.  If you have the grant, but no synonym, you can still access the table if you use the full [schema].[table_name] syntax.  If you don't have the grant, it doesn't matter if a synonym exists for the table or not - you wan't be able to "describe" it or select its contents.

I do not consider public synonyms to be bad.  I find them to be very helpful for objects that I want to be available across multiple schemas.  These are usually objects that I do grants on to "PUBLIC".
0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 35

Expert Comment

by:johnsone
ID: 40327716
I have found that for single application databases, public synonyms are fine.  When you add multiple applications, they can become a problem.  If you want to have all public synonyms, then names have to be unique across schemas, which defeats the purpose of multiple schemas to a certain extent.

I don't think public synonyms are bad, just not the remedy to this problem.  There are many people that do consider them bad.  A lot of them are auditors, if you use them be prepared to defend why you need public over private synonyms.  I have had auditors try to get me to drop the public synonym for DUAL and it was a fight to keep it.
0
 
LVL 14

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 40327831
I have had auditors try to get me to drop the public synonym for DUAL and it was a fight to keep it.
Seriously?! I would have beaten the shit out of him/her ;-)
0
 
LVL 35

Expert Comment

by:johnsone
ID: 40327837
I actually asked them if they would support the databases at that point because Oracle wouldn't.  They said no, so I didn't do it.

And, yes, they did ask that.  Said any public synonym or privilege granted to public was a security risk and was required to be dropped.
0
 

Author Closing Comment

by:joaotelles
ID: 40327848
Tks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question