Private synonym privileges

Hello i am new to oracle.can anyone help me with this problem?
I am able to create public and private synonym in main user 'system'
But while creating the same in other users 'scott'
1* create public synonym empdetails for emp
SQL> /
Synonym created.
public synonym is created but while trying for private synonym
SQL> CREATE SYNONYM empd for emp;
CREATE SYNONYM empd for emp
ERROR at line 1:
ORA-01031: insufficient privileges
Thanks in advance

Your system privileges:
select *  from USER_SYS_PRIVS
-- related to synonyms
select *  from USER_SYS_PRIVS WHERE PRIVILEGE like  '%SYNONYM%'If you don't have this privileges, you need to connect to another schema which can give scott this kind of privilege(you've already done in your first post from SYSTEM):
grant create /*public*/ synonym to scottYou could start reading here:
http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/schemaob.htm#CNCPT711
or
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_9013.htm#i2062318
and
http://wikis.sun.com/display/Forums/Forums+FAQ
Edited by: zep111 on Apr 18, 2011 5:16 PM
Ops. I've commented "public" in the grant.

Similar Messages

  • Private synonym created on  table not working in function

    hi,
    I have created a private synonym on a table.
    now i am trying to create a function below is the code of the same.
    FUNCTION party_name(p_cntr_id NUMBER)
    RETURN VARCHAR2 AS
    v_cust_name VARCHAR2(100);
    v_cust_no varchar2(100);
    BEGIN
    select occ.cust_no
    into v_cust_no
    from ops_cust_cntr occ
    where occ.ID = p_cntr_id;
    SELECT party_name
    INTO v_cust_name
    FROM hz_parties -- this is the table on which synonym is created .
    WHERE party_id = v_cust_no;
    RETURN (v_cust_name);
    EXCEPTION
    WHEN OTHERS THEN
    RETURN NULL;
    END party_name;
    it is giving the message
    SQL> sho errors;
    Errors for FUNCTION PARTY_TEST:
    LINE/COL ERROR
    12/1 PL/SQL: SQL Statement ignored
    14/6 PL/SQL: ORA-00942: table or view does not exist
    but when i run
    SELECT party_name
    FROM hz_parties;
    it is giving me the data.
    Please advice.
    Regards
    Sudhir.

    This has nothing to do with the synonym.
    Look at this:
    SQL> create table t1 (c1 number);
    Table created.
    SQL> create synonym test_tab for t1;
    Synonym created.
    SQL> create or replace procedure p1 as
      2    l_count pls_integer;
      3  begin
      4    select count(*)
      5    into   l_count
      6    from   test_tab;
      7    dbms_output.put_line(l_count || ' records found.');
      8  end;
      9  /
    Procedure created.
    SQL> exec p1
    0 records found.
    PL/SQL procedure successfully completed.
    SQL> I guess, you don't have the select privilege on this table.
    Remember: The privileg must be granted directly to the user who is the owner of the procedure/function/package. Privilege through a role are not valid inside the procedure/function/package.

  • Complex use of private synonyms

    I need to write a create user script that sets up our database. for production this is easy, but for development and test it gest complicated.
    We have 1 user that contains all of our data tables.
    another user that has all our code and our logging data.
    In development I need to create sets so developers can have their own environment.
    So how do I make code_user_a only see code_user_b's data without changing code? I think can do this with private synonyms, but I am not sure how to do it.

    First off. Synonyms have not changed over the last few version, but we are in 10.2
    Second off the point of the question is that I do not want to put them each in their own schema, I want it to mirror production. This is where the complexity comes from. I also don't want to change code.
    In production we will have two schemas
    Schema 1: All the tables that contain application data that users will see
    Schema 2: All the code and the logging tables
    This is a fairly standard deploy and not that uncommon. However, it gets complicated in development because I can have multiple "sets" of
    Schema 1
    Schema 2
    For example, a Developer named Jim and a Developer named Bob need to have their own set of schemas to do testing. So I need
    Schema1_Jim
    Schema2_Jim
    Schema1_Bob
    Schema2_Bob
    I only want Bob's Schema2(which has code that uses data in schema 1) to see schema1_Bob and not Schema1_Jim.
    It is not uncommon to deploy with multiple schemas for security reasons. I have seen it required by SOX auditors because the group that deploys the code is different than the group that deploys the data and the auditors say they are not allowed to share passwords.
    This is my requirement and I have to deal with it. The question is what is the best way to handle it in development. Productoin is easy becuase there is only one set of privileges.
    DBMS_WM is a good suggestion for a simple system. However, we have code that adds and drops partitions that need to act on the other schema so it won't work/.

  • Private synonym working

    Hi,
    I have created a private synonym and granted a select privilege in one schema (webcen) as shown below, it is working fine,but the same thing is not working in another schema.
    CREATE SYNONYM HZ_LOCATIONS FOR OPERAPPS.HZ_LOCATIONS;
    connected to operapps and granted the below privilage.
    grant select on HZ_LOCATIONS to testsafe;
    it is showing the message PL/SQL: ORA-00942: table or view does not exist
    please advice.
    Regards
    Sudhir

    Hi Panela,
    i ahve done the below mentioned steps that are working fine.
    user:safex_dev
    schema : webcen
    owner of table :operapps
    synonym creation:
    CREATE SYNONYM HZ_LOCATIONS FOR OPERAPPS.HZ_LOCATIONS;
    privilege :
    grant select on HZ_LOCATIONS to safex_dev;
    i am following the below steps in another schema but it is not working.
    user:testsafe
    schema : oadtb
    owner of table :operapps
    synonym creation:
    CREATE SYNONYM HZ_LOCATIONS FOR OPERAPPS.HZ_LOCATIONS;
    privilege :
    grant select on HZ_LOCATIONS to testsafe;
    Please advice.

  • Private synonym unknown obj type

    Hi,
    I'm making a script, that makes private synonyms for the new database schema "ABC", for our existing schemas.
    part of the script is:
    SELECT * FROM (
         SELECT owner, object_name FROM all_objects WHERE owner IN ('ETL') AND object_type IN ('TABLE', 'VIEW') AND object_name NOT LIKE '%$%' MINUS(
    SELECT table_owner, table_name FROM all_synonyms WHERE UPPER(owner) IN ('PUBLIC', 'ABC')
    AND UPPER(table_owner) IN ('ETL'))
    r_synonym     sys.all_objects%ROWTYPE;
         FOR r_synonym IN table_synonyms
         LOOP
         EXECUTE IMMEDIATE 'CREATE OR REPLACE SYNONYM ABC.'||r_synonym.object_name ||' FOR '||r_synonym.owner||'.'||r_synonym.object_name;
         END LOOP;
    Now, the synonym gets created, but the info shows me "<unknown obj type>" and as you can expect, the synonym doesn't work (even though it's created).
    Any ideas?
    Thx

    Does ABC have any privileges on the objects?
    E.g. a sysnonym on a table will not work if you don't have a privilege like SELECT or UPDATE.
    Regards
    Marcus

  • Private Synonyms Referencing

    Question in my text asks
    13. A private synonym:
    A. Can be seen by any user in the database who has privileges on it and has privileges on the
    synonym’s underlying object.
    B. Can only be seen by the user who creates it, and cannot ever be seen by any other user in
    the database under any circumstances.
    C. Is created with the CREATE PRIVATE SYNONYM statement.
    D. Is also called a “column alias” in a SELECT statement.
    Anser is A.
    My question is can't you grant privileges on the private synonym alone in order for it to be 'seen' by the given user.
    I mean normally you would grant a table privilege to a user, then create a synonym for it. What if we just created a synonym and granted privileges on the synonym without granting access to the table. Can't the user still see the synonym, without being able to query the table..?

    When you grant a privilege on a private synonym to a user oracle actually grants privilege to the underlying object itself. Just create a synonym and grant select privilege to some user for that synonym and then check the user_tab_privs for the granted user.

  • Expdp / impdp - Private synonyms using DB link not imported

    Hi
    I'd appreciate any help with this.
    We are taking an export (expdp) of a database on Oracle EE 10.2.0.3 in Prod and then importing it into an identical DB on 10.2.0.5 in Dev.
    I doubt the minor version difference is an issues, but I mention it for completeness.
    Our expdp in prod used to look like this:
    expdp agdba/x directory=DATA_PUMP_DIR dumpfile=X.DMP logfile=X.LOG schemas=A,B,C,D
    We have changed it to:
    expdp agdba/x directory=DATA_PUMP_DIR dumpfile=X.DMP logfile=X.LOG full=y EXCLUDE=SCHEMA:"IN ('E', 'F')"
    ( so basically do a full export, but exclude schemas E & F )
    The impdp in dev has not changed (we import one schema at a time):
    impdp agdba/x DUMPFILE=X.DMP LOGFILE=imp_X.LOG SCHEMAS=A DIRECTORY=DATA_PUMP_DIR TABLE_EXISTS_ACTION=SKIP
    DB user AGDBA has been granted the DBA role...
    The Issue:_
    Private synonyms that use a DB link are NOT imported, but private synonyms that do NOT use a DB link ARE imported.
    I can fix the issue by simply recreating the private synonyms using the DB link - e.g.:
    CREATE SYNONYM EVENTLOGTBL FOR EVENTLOGTBL@FCISTOSMS;
    Things were working fine until we change the expdp to use FULL. I see a few posts about synonyms and FULL=Y issues, but nothing quite like our problem.
    Any ideas?
    Thanks,
    Andreas

    Andreas Hess wrote:
    So the problem is expdp FULL=Y for some reason does not export synonyms that refer to objects via DB links. I doubt that ... More than few times a week I refresh non-prod databases from a prod db, (it is schema level export not FULL=Y), and two of the schema own db links, and others have synonyms pointing to them. I have never encountered synonym problem (except that if db_links are invalid then impdp takes extremely long time to timeout while compiling pl/sql code.). We normally change db_links after the impdp is done, or (while it is importing table via another session).
    I just re-ran sqlfile option with include=db_link,synonym option and i can see statements that create synonyms and create db links.
    However i think the order in which impdp runs might be the source of your problem ... see this
    Starting "ME"."SYS_SQL_FILE_SCHEMA_01":  ME/******** dumpfile=xxxx.%u.dmp directory=xxxx_exp schemas=schema1,schema2,schema3 sqlfile=schema.sql include=db_link,synonym
    Processing object type SCHEMA_EXPORT/SYNONYM/SYNONYM       <<<< Synonyms are created first
    Processing object type SCHEMA_EXPORT/DB_LINK               <<<< db_links come later
    Job "ME"."SYS_SQL_FILE_SCHEMA_01" successfully completed at 08:32:02So, it is conceivable that if you drop synonyms/db_links from your schemas before impdp, some synonyms will fail to create properly. This could be a version specific issue, mine is 11.2 and I don't see failures for synonym creation, i.e. no error messages while impdp. Next time you could try to drop objects except db_links and see if you still have the same issue.
    Raj

  • Can't view private synonyms in OWB 9.2.0.2

    Hi All,
    I have created a number of private synonyms in Schema A for objects that exist in Schema B. When querying these tables via SQLPLUS (whilst in Schema A) I have no problems but I can not see these synonyms when trying an import in OWB (my Source module is connect to Schema A). I have checked the "Use a synonym to look up objects" checkbox but I still only see physical objects in my shema and not synonyms.
    Any help would be hugely appreciated.
    Kind Regards
    Mitesh

    I would like to add that I have created the synonyms in SchemaA for object in SchemaB across using a DB_LINK. When I create the synonyms without the use of a db_link I have no problems but when using it I do?

  • Use of private synonyms for types breaks code

    Hi
    When using the following code snippet:
    =====================================
    OracleCallableStatement ocs = null;
    try {
    ocs = (OracleCallableStatement) conn.prepareCall("{ ? = call somemethod(?,?) }");
    ocs.setString(2, filter);
    ocs.registerOutParameter(1, Types.NUMERIC);
    ocs.registerOutParameter(3, OracleTypes.ARRAY, "SOME_TYPE");
    ocs.execute();
    ARRAY usersArray = ocs.getARRAY(3);
    Object[] structs = (Object[]) usersArray.getArray();
    We get an error when the registering of the type in the line
    ocs.registerOutParameter(3, OracleTypes.ARRAY, "SOME_TYPE");
    is done using a reference to a synonym rather than the direct name.
    The error occurs on the line
    Object[] structs = (Object[]) usersArray.getArray();
    We are using the 10.2.0.1.0 drivers against an 9.2.0.5 database.
    Any ideas are appreciated
    Leon

    Leon,
    I'm only guessing, but did you try setting the "includeSynonyms" [connection] property to 'true'?
    See the JDBC Developer's Guide and Reference for more details.
    Good Luck,
    Avi.

  • ORA-01031: insufficient privileges in PL/SQL but not in SQL

    I have problem with following situation.
    I switched current schema to another one "ban", and selected 4 rows from "ed"
    alter session set current_schema=ban;
    SELECT * FROM ed.PS WHERE ROWNUM < 5;
    the output is OK, and I get 4 rows like
    ID_S ID_Z
    1000152 1
    1000153 1
    1000154 1
    1000155 1
    but following procedure is compiled with warning
    create or replace
    procedure proc1
    as
    rowcnt int;
    begin
    select count(*) into rowcnt from ed.PS where rownum < 5;
    end;
    "Create procedure, executed in 0.031 sec."
    5,29,PL/SQL: ORA-01031: insufficient privileges
    5,2,PL/SQL: SQL Statement ignored
    ,,Total execution time 0.047 sec.
    Could you help me why SELECT does work in SQL but not in PL/SQL procedure?
    Thanks.
    Message was edited by:
    MattSk

    Privs granted via a role are only valid from SQL - and not from/within stored PL/SQL code.
    Quoting Tom's (from http://asktom.oracle.com) response to this:I did address this role thing in my book Expert one on one Oracle:
    <quote>
    What happens when we compile a Definer rights procedure
    When we compile the procedure into the database, a couple of things happen with regards to
    privileges.  We will list them here briefly and then go into more detail:
    q    All of the objects the procedure statically accesses (anything not accessed via dynamic SQL)
    are verified for existence. Names are resolved via the standard scoping rules as they apply to the
    definer of the procedure.
    q    All of the objects it accesses are verified to ensure that the required access mode will be
    available. That is, if an attempt to UPDATE T is made - Oracle will verify the definer or PUBLIC
    has the ability to UPDATE T without use of any ROLES.
    q    A dependency between this procedure and the referenced objects is setup and maintained. If
    this procedure SELECTS FROM T, then a dependency between T and this procedure is recorded
    If, for example, I have a procedure P that attempted to 'SELECT * FROM T', the compiler will first
    resolve T into a fully qualified referenced.  T is an ambiguous name in the database - there may be
    many T's to choose from. Oracle will follow its scoping rules to figure out what T really is, any
    synonyms will be resolved to their base objects and the schema name will be associated with the
    object as well. It does this name resolution using the rules for the currently logged in user (the
    definer). That is, it will look for an object owned by this user called T and use that first (this
    includes private synonyms), then it will look at public synonyms and try to find T and so on.
    Once it determines exactly what T refers to - Oracle will determine if the mode in which we are
    attempting to access T is permitted.   In this case, if we as the definer of the procedure either
    owns the object T or has been granted SELECT on T directly or PUBLIC was granted SELECT, the
    procedure will compile.  If we do not have access to an object called T by a direct grant - the
    procedure P will fail compilation.  So, when the object (the stored procedure that references T) is
    compiled into the database, Oracle will do these checks - and if they "pass", Oracle will compile
    the procedure, store the binary code for the procedure and set up a dependency between this
    procedure and this object T.  This dependency is used to invalidate the procedure later - in the
    event something happens to T that necessitates the stored procedures recompilation.  For example,
    if at a later date - we REVOKE SELECT ON T from the owner of this stored procedure - Oracle will
    mark all stored procedures this user has that are dependent on T, that refer to T, as INVALID. If
    we ALTER T ADD  some column, Oracle can invalidate all of the dependent procedures. This will cause
    them to be recompiled automatically upon their next execution.
    What is interesting to note is not only what is stored but what is not stored when we compile the
    object. Oracle does not store the exact privilege that was used to get access to T. We only know
    that procedure P is dependent on T. We do not know if the reason we were allowed to see T was due
    to:
    q    A grant given to the definer of the procedure (grant select on T to user)
    q    A grant to public on T (grant select on T to public)
    q    The user having the SELECT ANY TABLE privilege
    The reason it is interesting to note what is not stored is that a REVOKE of any of the above will
    cause the procedure P to become invalid. If all three privileges were in place when the procedure
    was compiled, a revoke of ANY of them will invalidate the procedure - forcing it to be recompiled
    before it is executed again. Since all three privileges were in place when we created the procedure
    - it will compile successfully (until we revoke all three that is). This recompilation will happen
    automatically the next time that the procedure is executed.
    Now that the procedure is compiled into the database and the dependencies are all setup, we can
    execute the procedure and be assured that it knows what T is and that T is accessible. If something
    happens to either the table T or to the set of base privileges available to the definer of this
    procedure that might affect our ability to access T -- our procedure will become invalid and will
    need to be recompiled.
    This leads into why ROLES are not enabled during the compilation and execution of a stored
    procedure in Definer rights mode. Oracle is not storing exactly WHY you are allowed to access T -
    only that you are. Any change to your privileges that might cause access to T to go away will cause
    the procedure to become invalid and necessitate its recompilation. Without roles - that means only
    'REVOKE SELECT ANY TABLE' or 'REVOKE SELECT ON T' from the Definer account or from PUBLIC. With
    roles - it greatly expands the number of times we would invalidate this procedure. If some role
    that was granted to some role that was granted to this user was modified, this procedure might go
    invalid, even if we did not rely on that privilege from that role. ROLES are designed to be very
    fluid when compared to GRANTS given to users as far as privilege sets go. For a minute, let's say
    that roles did give us privileges in stored objects. Now, most any time anything was revoked from
    ANY ROLE we had, or any role any role we have has (and so on -- roles can and are granted to roles)
    -- many of our objects would become invalid. Think about that, REVOKE some privilege from a ROLE
    and suddenly your entire database must be recompiled! Consider the impact of revoking some system
    privilege from a ROLE, it would be like doing that to PUBLIC is now, don't do it, just think about
    it (if you do revoke some powerful system privilege from PUBLIC, do it on a test database). If
    PUBLIC had been granted SELECT ANY TABLE, revoking that privilege would cause virtually every
    procedure in the database to go invalid. If procedures relied on roles, virtually every procedure
    in the database would constantly become invalid due to small changes in permissions. Since one of
    the major benefits of procedures is the 'compile once, run many' model - this would be disastrous
    for performance.
    Also consider that roles may be
    q    Non-default: If I have a non-default role and I enable it and I compile a procedure that
    relies on those privileges, when I log out I no longer have that role -- should my procedure become
    invalid -- why? Why not? I could easily argue both sides.
    q    Password Protected: if someone changes the password on a ROLE, should everything that might
    need that role be recompiled?  I might be granted that role but not knowing the new password - I
    can no longer enable it. Should the privileges still be available?  Why or Why not?  Again, arguing
    either side of this is easy. There are cases for and against each.
    The bottom line with respect to roles in procedures with Definer rights are:
    q    You have thousands or tens of thousands of end users. They don't create stored objects (they
    should not). We need roles to manage these people. Roles are designed for these people (end users).
    q    You have far fewer application schema's (things that hold stored objects). For these we want
    to be explicit as to exactly what privileges we need and why. In security terms this is called the
    concept of 'least privileges', you want to specifically say what privilege you need and why you
    need it. If you inherit lots of privileges from roles you cannot do that effectively. We can manage
    to be explicit since the number of development schemas is SMALL (but the number of end users is
    large)...
    q    Having the direct relationship between the definer and the procedure makes for a much more
    efficient database. We recompile objects only when we need to, not when we might need to. It is a
    large efficiency enhancement.
    </quote>

  • Use of synonyms in procedures

    In my procedure I need to select from a table in another schema. There is a public synonym for the table but I keep getting the compile error, 'Table or view does not exist'. I also tried making a private synonym with the same compilation results. I heard that in a procedure you can't select from a synonym but you can from a private one. Anyone know if that is true? Any suggestions?

    I heard that in a procedure you can't select from a synonym but you can from a private one.Horse feathers.
    What you actually got is permissions problems: we cannot build procedures (or views for that matter) on tables belonging to other users who have granted us privileges through a role. If you get user B to grant you SELECT or whatever directly to your user account you will be able to build your procedure.
    Cheers, APC

  • Synonym advantages in Oracle

    What is synonym? and what r the advantages of using synonyms

    From good old Oracle documentation..
    A synonym is an alias for any table, view, snapshot, sequence, procedure, function, or package. Because a synonym is simply an alias, it requires no storage other than its definition in the data dictionary.
    Synonyms are often used for security and convenience. For example, they can do the following:
    Mask the name and owner of an object
    Provide location transparency for remote objects of a distributed database
    Simplify SQL statements for database users
    You can create both public and private synonyms. A public synonym is owned by the special user group named PUBLIC and every user in a database can access it. A private synonym is in the schema of a specific user who has control over its availability to others.
    Synonyms are very useful in both distributed and nondistributed database environments because they hide the identity of the underlying object, including its location in a distributed system. This is advantageous because if the underlying object must be renamed or moved, then only the synonym needs to be redefined. Applications based on the synonym continue to function without modification.
    Synonyms can also simplify SQL statements for users in a distributed database system. The following example shows how and why public synonyms are often created by a database administrator to hide the identity of a base table and reduce the complexity of SQL statements. Assume the following:
    A table called SALES_DATA is in the schema owned by the user JWARD.
    The SELECT privilege for the SALES_DATA table is granted to PUBLIC.
    At this point, you have to query the table SALES_DATA with a SQL statement similar to the one below:
    SELECT * FROM jward.sales_data;
    Notice how you must include both the schema that contains the table along with the table name to perform the query.
    Assume that the database administrator creates a public synonym with the following SQL statement:
    CREATE PUBLIC SYNONYM sales FOR jward.sales_data;
    After the public synonym is created, you can query the table SALES_DATA with a simple SQL statement:
    SELECT * FROM sales;
    Notice that the public synonym SALES hides the name of the table SALES_DATA and the name of the schema that contains the table.

  • Doubts in Creating Synonym

    We have Oracle9i, i have seen about synonym.
    I have some doubts...
    1. Is that we can create synonym for objects like Packages, stored
    procedures,views and Functions.
    2. How Synonyms helpful in user privileges?.
    3. What is Public and Private Synonyms?
    I have seen some documents but they couldnot clear my doubts....
    Any one can help me in this please

    A quick example :
    SQL> desc myusers
    Name                                      Null?    Type
    USERNAME                                  NOT NULL VARCHAR2(30)
    USER_ID                                   NOT NULL NUMBER
    CREATED                                   NOT NULL DATE
    SQL> grant create session to toto identified by toto;
    Grant succeeded.
    SQL> grant select on myusers to toto;
    Grant succeeded.
    SQL> grant create synonym to toto;
    Grant succeeded.
    SQL> conn toto/toto@H89UCBAC
    Connected.
    SQL> desc myusers
    ERROR:
    ORA-04043: object myusers does not exist
    SQL> desc h89ucbac.myusers
    Name                                      Null?    Type
    USERNAME                                  NOT NULL VARCHAR2(30)
    USER_ID                                   NOT NULL NUMBER
    CREATED                                   NOT NULL DATE
    SQL> create synonym myusers for h89ucbac.myusers;
    Synonym created.
    SQL> desc myusers
    Name                                      Null?    Type
    USERNAME                                  NOT NULL VARCHAR2(30)
    USER_ID                                   NOT NULL NUMBER
    CREATED                                   NOT NULL DATE
    SQL> HTH,
    Nicolas.

  • Grant sequence privilege issue

    Hi,
    OS is windows server 2008
    Database oracle 11g r2
    i have created a schema with name SME having DBA privilege from SME i have created another user SME_USER using the same tablespace of SME with limited privileges. The sequence was created in SME user. I am accessing the tables from SME schema. I have given insert privilege to one of the table in SME to SME_USER,but while insertiing we are using the sequnece with name IPSRNO from SME schema. Now when i tried to insert value inot the table from SME_USER its giving me the output "Sequence does not exist". I have given the grant select privilege for sequence IPSRNO.
    Please guide me on this issue.
    Regards,
    Bobby

    See Using Synonyms in DML Statements in the DBA guide
    http://docs.oracle.com/cd/B28359_01/server.111/b28310/views003.htm
    >
    You can successfully use any private synonym contained in your schema or any public synonym, assuming that you have the necessary privileges to access the underlying object, either explicitly, from an enabled role, or from PUBLIC. You can also reference any private synonym contained in another schema if you have been granted the necessary object privileges for the underlying object.
    You can reference another user's synonym using only the object privileges that you have been granted. For example, if you have only the SELECT privilege on the jward.emp table, and the synonym jward.employee is created for jward.emp, you can query the jward.employee synonym, but you cannot insert rows using the jward.employee synonym.
    A synonym can be referenced in a DML statement the same way that the underlying object of the synonym can be referenced. For example, if a synonym named employee refers to a table or view, then the following statement is valid:
    INSERT INTO employee (empno, ename, job)
    VALUES (emp_sequence.NEXTVAL, 'SMITH', 'CLERK');
    If the synonym named fire_emp refers to a standalone procedure or package procedure, then you could execute it with the command
    EXECUTE Fire_emp(7344);

  • Public Synonyms...

    SQL> show user
    USER is "SYS"
    SQL> select * from dba_synonyms where synonym_name = 'BANK';
    OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME
    PUBLIC BANK SEGERP BANK
    AMCTESTLHR BANK AMCERPTEST BANK
    SQL> conn rakesh/rakesh@testapp
    Connected.
    SQL> select * from bank;
    select * from bank
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL>
    Why Didn't rakesh can access the bank [Public Synonym] It can be accessed by any schema?

    Synonyms (public or private) are just aliases for an object. They do not imply permission to use that object for a particular user.
    In your case, any user (except amctestlhr) can do select * from bank and get data from segerp.bank provided they are allowed to select from that table. Without the public synonym, all user who had select privilege would need to either create their own private synonym, or do select * from segerp.bank.
    John

Maybe you are looking for