How can acces by other users ?????
Emit, May 31, 2001 - 12:27 pm UTC
If i not create the public synonym others users can acces to the object, what i need to create for acces that object created without synonym ?
Tom
Akhilesh, September 18, 2001 - 2:52 am UTC
Public Synonyms
A reader, January 30, 2009 - 7:11 pm UTC
Hi Tom,
Technically:
1) What additional step Oracle has to perform with synonyms, which could lead to more usage of CPU? and
2) Though I don't work directly in oracle applications, but I came to know that Oracle applications uses synonyms quite a lot, if true, then probably that is good candidate for improving Oracle apps performance...
Regards,
January 30, 2009 - 9:12 pm UTC
1) forget performance - I give up on performance discussions as a tool to get things in the right direction.
They are wrong because they flood the namespace - making consolidation impossible.
They are a level of indirection that confuses everyone - now and especially in the future.
They allow for trojans to be injected into a system easily - you are NOT the only one with create public synonym. There is a really good practice I hadn't even thought about fully that came up recently. Here it is:
when coding plsql, do not call something like dbms_output.put_line (relying on that synonym...) - do call SYS.dbms_output.put_line - you cannot have your code get kidnapped and execute other code you did not intend accidentally - using YOUR privileges.
2) forget performance, it has come up as a security issue - Starting from now and forever - I'll be hitting on security aspects. Too many people say "performance smormance, I don't care". Turn it into a security issue and they pop their heads up and take notice.
Overused
Parthiban Nagarajan, May 10, 2011 - 8:30 am UTC
Hi Tom
We have only one application schema and let it be 'XYZ' ...
Based on the counts given below, may I have your comments on our usage of Public Synonyms? I think, we can go for execute immediate 'alter session set current_schema=''XYZ''' in an after logon trigger (because of only one application schema);
SQL> select count(*) from all_synonyms where owner = 'PUBLIC' and table_owner = 'XYZ';
COUNT(*)
----------
2324
SQL> select count(*) from all_tables where owner = 'XYZ';
COUNT(*)
----------
873
SQL> select count(*) from all_views where owner = 'XYZ';
COUNT(*)
----------
445
SQL> select count(distinct object_name)
2 from all_procedures
3 where owner = 'XYZ' and object_type = 'PACKAGE' and procedure_name is not null;
COUNT(DISTINCTOBJECT_NAME)
--------------------------
171
SQL> select count(*)
2 from all_synonyms syn
3 join all_tables tab
4 on (syn.table_owner = tab.owner
5 and syn.table_name = tab.table_name)
6 where syn.owner = 'PUBLIC'
7 and syn.table_owner = 'XYZ';
COUNT(*)
----------
859
SQL> select count(*)
2 from all_synonyms syn
3 join all_views viu
4 on (syn.table_owner = viu.owner
5 and syn.table_name = viu.view_name)
6 where syn.owner = 'PUBLIC'
7 and syn.table_owner = 'XYZ';
COUNT(*)
----------
428
SQL> select count(distinct object_name)
2 from all_synonyms syn
3 join all_procedures prc
4 on (syn.table_owner = prc.owner
5 and syn.table_name = prc.object_name)
6 where syn.owner = 'PUBLIC'
7 and syn.table_owner = 'XYZ'
8 and prc.object_type = 'PACKAGE'
9 and procedure_name is not null;
COUNT(DISTINCTOBJECT_NAME)
--------------------------
171
SQL>
Though I am not sure of the performance impact, I am damn sure that the public synonyms are not wisely used here (given that we have another good alternative)
May 10, 2011 - 9:17 am UTC
it was higher than one (the count) so I personally think you used too many. I'll give you one maybe. If you can really justify the need.