How Public synonym works.

When a search is done in data in a table via a public synonym, not the associated table, the index is used or not. I think he did, but I want to be sure, can someone also confirms this.

Thank you

Hello

Yes, of course public synonyms use underlying indices. Its very simple test.

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

SQL>
SQL>
SQL> create table t as select rownum x from dual connect by level <=10000;

Table created.

SQL> exec dbms_stats.gather_table_stats(user, 't');

PL/SQL procedure successfully completed.

SQL> create index t_idx on t(x);

Index created.

SQL> create public synonym pub_t for test.t;

Synonym created.

SQL> set autotrace traceonly exp
SQL> select * from t where x = 5;

Execution Plan
----------------------------------------------------------
Plan hash value: 2946670127

--------------------------------------------------------------------------
| Id  | Operation        | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT |       |     1 |     3 |     1   (0)| 00:00:01 |
|*  1 |  INDEX RANGE SCAN| T_IDX |     1 |     3 |     1   (0)| 00:00:01 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("X"=5)

SQL> select * from pub_t where x = 5;

Execution Plan
----------------------------------------------------------
Plan hash value: 2946670127

--------------------------------------------------------------------------
| Id  | Operation        | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT |       |     1 |     3 |     1   (0)| 00:00:01 |
|*  1 |  INDEX RANGE SCAN| T_IDX |     1 |     3 |     1   (0)| 00:00:01 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("X"=5)

SQL> set autotrace off;
SQL>

Tags: Database

Similar Questions

  • How to check what are the objects using this public synonym?

    Hi Experts

    Currently, I have a public synonym, WORK that is created for WORK table in the schema of the BRAND: "synonym PUBLIC EMPLOYMENT BRAND. JOB. "
    SELECT THIS OPTION. WORK is granted to the TOM_UPDATE (a role): GRANT SELECT ON MARK. JOBS AT TOM_UPDATE;

    I am using TOAD 9.6.1.1 and I wanted to drop the public synonym but I am not able to see that another object in the database uses this public synonym, JOB.

    Help, please.

    moslee wrote:
    Hi Experts

    Currently, I have a public synonym, WORK that is created for WORK table in the schema of the BRAND: "synonym PUBLIC EMPLOYMENT BRAND. JOB. "
    SELECT THIS OPTION. WORK is granted to the TOM_UPDATE (a role): GRANT SELECT ON MARK. JOBS AT TOM_UPDATE;

    I am using TOAD 9.6.1.1 and I wanted to drop the public synonym but
    I am not able to see that another object in the database uses this public synonym, JOB.

    The objects are not "use the synonym".
    The code use synonym to access object.

    use grep allows you to browse the source code that resides in your repository

  • How to revoke all privileges on a public synonym of a user

    How to revoke all privileges on a public synonym of a user in 9i?

    you know the difference between PRIVATE and PUBLIC means?

    Public synonyms are accessible to all users.
    Private is accessible only inside its schema.

    If you do not want this user, use this synonym drop it and create a synonym in other schemas where users need.

  • Public synonyms in a pluggable database deletion

    I have a base Oracle container 12 c with pluggable databases in it.  In a pluggable data bases, I uninstalled OLAP by running the following scripts:

    SQL > @%oracle_home%/olap/admin/catnoamd.sql

    SQL > @ /olap/admin/olapidrp.plb% oracle_home %

    SQL > @ /olap/admin/catnoxoq.sql% oracle_home %

    SQL > @ /olap/admin/catnoaps.sql% oracle_home %

    After you run the scripts, I then generated SQL statements to remove invalid OLAP synonyms, by executing the following:

    Select ' drop public synonym ' | object_name | ';'

    from dba_objects

    where <>of status "VALID."

    and owner = 'PUBLIC '.

    and object_type = 'SYNONYM '.

    and object_name like '% OLAP % ';

    When I run the SQL statements resulting in the snap-in data base, I get the following error for each of them:

    ERROR on line 1:

    ORA-65040: operation not allowed a pluggable database

    If I switch back to the ROOT of PEH container $ and executes the same statements, I get the following error:

    ERROR on line 1:

    ORA-01432: due public synonym being abandoned does not exist

    How can I remove these invalid public synonyms for my snap-in database?

    I think you're right. I re-read the note that I mentioned above. Even uninstalling an option is not supported for a CBD so far. Only option is to disable it. Second option is to create a non - CBD, uninstall option is not required and then plug it into a CBD.

    Salman

    ----------

    http://salmandba.blogspot.com

  • Privileging the public synonym over schema object

    Hello

    I have a request.

    I logged in a scheme called "SCOTT."

    I have a table called 'EMP '.

    Now, I created a view called "EMP_D" with the addition of more of a few columns.

    Now I create a public synonym 'EMP' pointing to display "EMP_D".

    Now, I'm pulled the query in the schema "SCOTT."

    Select * from EMP

    I want that data to the EMP_D view.

    How to get there?

    Thanks in advance

    S. Jean-Charles

    user629814 wrote:

    My question is

    is it possible to prioritize the resulting public synonym of the same schema?

    Its only for a solution.

    This is called "name resolution" and is documented here: http://docs.oracle.com/cd/B28359_01/server.111/b28310/general008.htm#ADMIN11561

    1 oracle database attempts to qualify the first piece of the name referenced in the SQL statement. For example, in scott.emp , scott is the first piece. If there is only one piece, the piece is considered to be the first piece.

    1. In the current schema, the database looking for an object whose name matches the first part of the name of the object. If it does not find such an object, it continues with step b.
    2. The database looking for a public synonym that matches the first part of the name. If it does not find one, it continues with stepc.
    3. ...

    So if you have a schema object with the same name as a public synonym, oracle will always use first the schema object.

    Your only chance would be to rename the schema object or use another schema.

  • 2 various CARS: same Public Synonyms on the same 2 diagrams - any interaction?

    I'm having a senior moment.

    I have not worked with public synonyms that often, so I just want to make sure I got it right.

    If you have two instances: Instance1 and Instance2

    They both live on the same Oracle RAC cluster.

    Intance1 and Instance2 have a schema named FRED.  Both of them have a synonym Public THISTABLE for FRED. THISTABLE

    Now, I want to just make sure that the public synonyms do NOT connect between two different, although instances on the same RAC system, right?

    Someone on Instance2 inserting in fred.thistable is ONLY for this instance, instance1 do not affect all, correct?

    You would have to do something like this, essentially a database link between them and could have a public link THISTABLE on Instance2 pointing to FRED. THISTABLE on Instance1... but simply want to make sure that I understand that only a dblink between two patterns on the two bodies will... allow traffic/access between the two bodies and public synonyms on their own will not cross the instance gap, even with two instances on the same cluster.

    Once again, senior moment here and just want to make sure I have it directly.

    Thanks in advance,

    Cayenne

    This case I put in place the same pattern of FRED and the same FRED table name. TABLEAUCETTE on the database instance instsqa... There is no link between the two with this public synonym on instdev. The only way you could link the two instances and schemas for the table would be by a... correct database link?

    Yes. You got right.

    Take CARS out of it.  It's the same as if you had 2 databases one-off names instdev and instqa.

    Post edited by: Brian Bontrager

  • Which granted CREATE a PUBLIC SYNONYM for user SCOTT?

    version: 11.2.0.3
    Operating system: Solaris 10

    Auditing is enabled in our database.
    SQL> show parameter audit_trail
     
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    audit_trail                          string      DB
    Of DBA_SYS_PRIVS, we have confirmed that one of our DBA colleagues gave some risky privileges like CREATE PUBLIC SYNONYM, SELECT ANY TABLE... etc. to the user SCOTT.

    We would like to find out 2 things
    1. the SQL GRANT
    2. the date and time on which the statetement GRANT was pulled


    How can we find it?

    Y.Ramlet wrote:
    version: 11.2.0.3
    Operating system: Solaris 10

    Auditing is enabled in our database.

    SQL> show parameter audit_trail
    
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    audit_trail                          string      DB
    

    Of DBA_SYS_PRIVS, we have confirmed that one of our DBA colleagues gave some risky privileges like CREATE PUBLIC SYNONYM, SELECT ANY TABLE... etc. to the user SCOTT.

    We would like to find out 2 things
    1. the SQL GRANT

    You will have no SQL in the audit trail, because you have not configured the parameter correctly. You must audit_trail = db, extended to get the SQL code.

    2. the date and time on which the statetement GRANT was pulled

    You will have anything unless you have enabled auditing for the instruction given with
    Check create public synonym;

    How can we find it?

    You can't until you configure the audit in an appropriate manner.

  • name of the permission for ' drop public synonym '.

    We fall synonymous public as:
    GRANT DROP PUBLIC SYNONYM TO User1;
    How the permission/role is named to run this statement?
    What table I can query to see if my connected user has this right?
    I googled but did not.

    You must DROP PUBLIC SYNONYM privilege.

    You can determine if your username has this privilege by running the following query:

    SELECT *
    FROM   dba_sys_privs
    WHERE  grantee   = 'your user here'
    AND    privilege = 'DROP PUBLIC SYNONYM'
    ;
    
  • Is it possible to perform a search on Android content of a current Web page? If so, how could put upward and how does it work?

    Nice day!
    Dear Sirs / ladies,.
    You have a manual how to search the contents of the current Web page:
    https://support.Mozilla.org/en-us/KB/search-contents-current-page-text-or-links

    Unfortunately, I wasn't able to find the same option for Android.
    Is this possible?
    How does it work?

    sincerely
    Summerman

    See the attached screenshot for searching in the location of the page in our menu.

    This is a somewhat new. You must make sure, that you are on the latest version of Firefox for Android, version 37. You can check by typing about: firefox in the address bar. The version will be in the upper left corner of the page.

  • Time capsule will save my laptop complete? Which means that if it crashes, breaks, etc. I'll be able to restore all my memory/data on a new laptop? Exactly how does it work? Thank you.

    Time capsule will save my laptop complete? Which means that if it crashes, breaks, etc. I'll be able to restore all my memory/data on a new laptop? Exactly how does it work? Thank you.

    Yes. Time Capsule uses the Time Machine on your Mac software. Here is information on both and the restoration:

    http://www.Apple.com/airport-time-capsule/

    Use Time Machine to back up or restore your Mac - Apple Support

  • What is efax and how does it work?

    Hello!

    eFax® is a service provided by eFax®, not Hewlett-Packard, which allows you to send and receive faxes using the Internet instead of a phone line. eFax® is easy to use, but it is different from a typical telephone fax. You do not need a phone line to use it, so you don't have to worry about busy signals and you can place your printer where you want to, not where the phone plugs are! The fax number you are provided will not generally be a local number and maybe even in a different country. You will receive 20 entrants and 20 pages of outgoing fax per month for free with this service. Your account page will reset at midnight Pacific, the first of each month time. You can also subscribe to eFax® more to get additional pages by month by visiting: http://www.eFax.com/products/internet-fax.

    How does it work?

    Hi Im_cheesecake,

    Great information, if you don't mind I just want to piggy back off of your post, to eliminate any likelihood of confusion.

    The 20 free incoming & 20 free outgoing faxes are with HP printer which include the impression of the eFax service application.  From now on, we have three series printers that include the application pre-installed print eFax: HP Photosmart 7510 Series, series of 110 HP Envy and HP Photosmart eStation C510a.

    

    eFax also has a free plan that allows you to receive a limited number of faxes, but cannot send faxes. If you exceed the allowed number of received faxes, eFax invite you to upgrade to a paying account. Here are the main Details of the free plan:

    • A (i.e., non-local) eFax number distance
    • Regional/prefix code is selected by eFax and is not editable (except if you upgrade to a paid account)
    • 20 pages of incoming faxes per month (reception only)
    • You are prompted to upgrade to a paid account if you exceed 20 inbound pages, or if you need to send capacity.

  • How can I work with two icloud ID on the same pc?

    How can I work with two icloud ID on the same pc?

    Define "work".

    What exactly do you want to accomplish?

    You can use the iCloud Panel to connect to iCloud account and use a browser to go to icloud.com and sign in with another account.

  • Please can someone explain how this circuit works?

    I was digging through some old files left here by a former employee and found this.  There is a text file with it that said it was a temperature alarm that was supposed to have a green light when the temperature was between 50 and 100, but a red light at any other temperature.  I can play with it and see that the lights are changing, but how to check temperatures?  Also, how this circuit works?  I never did something like this on my own, but I see what seems to be a comparator is powered by two OPERATIONAL amplifiers.  May of you please enlighten us on this so I can prove that it works?  I have a use for this, but I need to know if it will work in its current form, or if I need to make some adjustments.

    Although this tour might work in simulation there several defects that could cause problems if implemented in hardware.

    First, the Thermistors generally have a nonlinear inverse relationship to temperature. In this case this isn't a huge deal since temperatures too high or too low, the two are supposed to turn on the red LED. However, defining the thresholds of comparator at 1/3 and 2/3 of Vcc2 aren't very likely to correspond to the desired temperature.

    Then the LM324 has an R4 and R5 totem-pole output circuit are rather empty.  The output circuit can source or sink tens of milliamps for emitter junctions base of Q1 and Q2 may be vulnerable to damage.

    When Q3 and Q4 are disabled, as shown in the picture, the current flowing through the Green LED is 30 my. Indication LEDs are usually evaluated for 20 my or less.

    When Q3 or Q4 is enabled, the current flowing through the red LED is limited by the transconductance of transistors or the V-I characteristic of the diode. In both cases, the values are almost certainly in the 'let the magic smoke out' of the LED range.

    Although not destructive, Q3 and Q4 are not necessary.  The logic can be changed by reversing entries for the elements of comparison and by replacing maybe to OR AND on the transistor connections.

    Lynn

  • How involved funciton works?

    How involved funciton works when using digital controls?


  • How can I work from my deskstop PCs, directly in a foledr shared under win server 2008 so that all my work is saved directly on the server.

    How can I work from my deskstop PCs, directly in a foledr shared under win server 2008 so that all my work is saved directly on the server.

    what I try to do is the following.

    I installed winserver 2008 on a machine and I created a folder for the individual. I want the individaul to connect in the folder ocreated on winserver 2008 directly from their desktop and laptop computers and their work so that all works are recorded directly on the server.

    Post in the Windows Server Forums:
    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer/

Maybe you are looking for