create a synonym private to another schema

Hello

Oracle 10.2.0.4

We have a number of base < table_name > tables in source schema. I have created hace views on certain tables as table_view < TABLE_NAME_VIEW >

DBA has created a new user called view_user and a role called view_user_role.

SELECT on these points of view permissions are granted to the view_user_role as GRANT SELECT ON < TABLE_NAME_VIEW > to view_user_role

If I connect as long as user view_user I can do SELECT in source.table_view and it works SELECT * from source. < TABLE_NAME_VIEW >

I can also create (as the owner of the source schema) public synonym with the same name as the name of the table for easy selection

CREATE PUBLIC SYNONYM < table_name > FOR < table_name > _VIEW

It works and view_user can select < table_name >

However, I like to create views for this user only. When I try to do (as the owner of the source schema)

CREATE or REPLACE the view_user SYSNONYM. < table_name > FOR source. < TABLE_NAME_VIEW >

I get insufficient privileges!

No idea how I can fix this problem? What advantage is there to create private views as a public view will work like no one else has view_user_role

Thank you

Some people like not synonymous public but we use them.  If end users have their own unique Oracle user names and where you have a couple asks a thousand items, create a synonym private for each user is impractical.  If a new object is created back and in defining a synonym private for each user who needs access to the object is not very practical.  Create a public synonym for each object and be done with it.  A user should always select or privilege of running on the underlying to see object that it so all the public synonym is to provide access once the privilege of the object has been obtained (if all goes well through a role).

HTH - Mark D Powell.

Tags: Database

Similar Questions

  • Error in the call to a procedure that is packed on another schema with the alias name

    Hi all

    I call a packaged procedure that has the type as a parameter collection that resides in the remote database by using synonyms.for which I am creating a synonym in my current schema.

    Below the package in the remote database:
    CREATE or REPLACE PACKAGE test_hlr BODY
    AS
    PROCEDURE raj_test)
    pi_username IN VARCHAR2,
    pi_serial_no IN arr_numb, - type of user-defined collection
    po_error_code OUT NUMBER
    )
    AS
    BEGIN
    BECAUSE me IN pi_serial_no. FIRST... pi_serial_no. LAST
    LOOP
    INSERT INTO hlr_raj
    (user_name, serial_no
    )
    VALUES (pi_username, pi_serial_no (i)
    );
    END LOOP;
    END;
    END;



    I'm create synonym of package in my current database and call this package synonymous as shown below

    create synonym ram_test for ram_test@dblink

    CREATE or REPLACE PACKAGE test_bnr BODY
    AS

    PROCEDURE ram_test)
    pi_username1 IN VARCHAR2,
    pi_serial_no1 IN arr_numb, - type of user-defined collection
    po_error_code OUT NUMBER
    )
    AS

    BEGIN
    test_hlr.raj_test (pi_username = > pi_username1,)
    pi_serial_no = > pi_serial_no1,
    po_error_code = > po_error_code
    );
    END;
    END;

    When compiling above package am getting error below
    PLS-00306: wrong number or types of arguments in the call to ' RAJ_TEST


    If I remove the collection type and use types of primitive data and then do not get error.

    Please give suggestions, about the same.

    Kind regards
    Sri Ram.

    There is no need to declare the type arr_numb locally. In fact, two types with exact same statement and namesake are not the same type. Each type has a unique OID. You can specify own OID. Then you can create the types the and remote with same OID. But if the type is the type of PL/SQL it didn't need to. For example. ON remote DB:

    create or replace
      package pkg1
        as
          type arr_numb is table of number;
          procedure p1(
                       p_numb_arr IN arr_numb,
                       p_sum OUT number
                      );
    end;
    /
    create or replace
      package body pkg1
        as
          procedure p1(
                       p_numb_arr IN arr_numb,
                       p_sum OUT number
                      )
            is
            begin
                for i in 1..p_numb_arr.count loop
                  p_sum := nvl(p_sum,0) + p_numb_arr(i);
                end loop;
          end;
    end;
    /
    

    Now locally:

    set serveroutput on
    declare
        v_numb_arr pkg1.arr_numb@sol10;
        v_sum number;
    begin
        v_numb_arr := pkg1.arr_numb@sol10(1,2,3,4,5,6,7,8,9);
        pkg1.p1@sol10(v_numb_arr,v_sum);
        dbms_output.put_line(v_sum);
    end;
    /
    45
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

  • create existing table in another schema

    Hi master,

    We are using oracle 10g R2 on linux.

    I have a scheme say user1 with many tables, starting with

    BC_ (50 PICTURES)

    PC_ (20 TABLES)

    LC_ (30 TABLES) etc.,.

    now, I want to create these tables in another schema with their constraints and their privileges in another schema.

    as I want to generate a create table script, which will create a table that begins with "BC_" only. another script will create table starting with "PC_" only. and like that.

    is it possible with the command

    create the table AS
    Select * from (old scheme). (table_name);

    can we use query sub in it to be more precise?

    and it will transfer all its privileges and grants the new schema?


    Thanks and greetings
    VD

    It is possible to CREATE TABLE as SELECT from a different scheme but CREATE TABLE as SELECT will transfer only the data and the structure of the base (column names and data types) table, no constraints.
    I think, you have two options to do this easily:
    (1) use SQLDeveloper (GUI) or a procedure from PL/SQL DBMS_METADATA. GET_DDL to generate the SQL script to create table with constraints, you can use INSERT INTO new table (columns) column SELECT FROM oldschema.oldtable
    DBMS_METADATA Description: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414

    (2) export a schema data, import it into the other using Data Pump or exp/IMP.
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14215/dp_export.htm#i1007466

  • How to use the type of packages, procedures and functions in another schema?

    I have two schema target in an OWB project, such as A and b. In a map of A, I would use some packet types, functions and procedures of B. I tried the method of the suggested such synonym, but I couldn't find the metadata of these when importing... The only type of synonym I can import is the synonym for the table. Y at - it a bug for synonym?

    If I can't use a synonym for that matter, is there another way to solve the problem?

    Now, in some cases you will absolutely need to create the second module as Carsten described, but it should also be noted that you can reference objects in things like Expressions even if you have not loaded the metadata. It's only when you need strong bonding that it becomes necessary to import objects. For everything else, as long as the reference can solve during the compilation so you are good to go.

    For example, I target a function in a schema (S1) and a synonym private that it in another (s2). A mapping of the S2 schema has an expression object that uses the synonym of the function in the expression property for a couple of the attirbutes of output. The synonym has not been loaded in metadata - OWB has indeed no knowledge of its existence. But she is resolved at compile time if the mapping validates and generates successfully.

    Mike

  • Problem to change a sequence from another schema

    Hello

    My question is a continuation to the thread below.

    problem using sequences of a diagram to another diagram

    Here, I tried to access a sequence created in schema2 in Figure 1.

    I gave both select and change privileges on the encoder in Figure 1 and I see the same thing in the all_tab_privs table.

    Now, I created a synonym in the diagram 1 'create a synonym seq for schema2.seq '. By doing this, I could access the seq directly (without the schema name) in Figure 1. But when I try to change directly (without the schema name). I got the errorORA-02289: sequence does not exist.

    But I can able to alter using the full name schema2.seq.

    Can anyone tell why this anamoly?  He takes everything by choosing synonym, but not while altering.

    My question is a continuation to the thread below.

    problem using sequences of a diagram to another diagram

    Not really--your question has NOTHING to do with the question in this thread.

    Here, I tried to access a sequence created in schema2 in Figure 1.

    I gave both select and change privileges on the encoder in Figure 1 and I see the same thing in the all_tab_privs table.

    Now, I created a synonym in the diagram 1 'create a synonym seq for schema2.seq '. By doing this, I could access the seq directly (without the schema name) in Figure 1. But when I try to change directly (without the schema name). I got the errorORA-02289: sequence does not exist.

    But I can able to alter using the full name schema2.seq.

    Can anyone tell why this anamoly?  He takes everything by choosing synonym, but not while altering.

    Simple - funcitionality is NOT supported by Oracle for synonyms. See the CREATE SYNONYM statement in the doc of the SQL language

    https://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_7001.htm

    You can refer to synonyms in the following DDL statements: AUDIT , NOAUDIT , GRANT , REVOKE , and COMMENT .

  • grant the select privilege on the table in another schema by role error

    Hello
    I have a problem with the granting of privileges to another schema
    I have A user who has only 1 system priv: connect, which has a private: create session;
    I created a role X, which I have the privilege: select on a table to a diagram B customer.
    I then conceded this X role to A user.
    I can't select * B.customers when im connected to A
    identification of information like it that I'm missing?
    Thank you
    Rgds

    >
    but whenever I put a default role, the other is automatically set to zero-defects

    How did you receive the two default roles?
    >
    By running the code I posted above as user SYS.

    Drop your user and start again and use the code I posted.

  • Access to the content of the tables of a schema into another schema

    Hello

    I have my doubts... Suppose I have a user called DEMO and it has tables. now I have another user called DEMO1

    my doubt is. How can I get the DEMO user tables in DEMO1. If updating the table DEMO1 which should reflect

    DEMO user. Help me...

    Dear friend,

    You can consult the tables of a schema in another schema using the following steps.

    (1) you must grant privileges on table demo Demo1, here's the statement to do so.

    Grant Select, update on the table table_name to Demo1

    (2) Create in Demo1 for the table_name demo, the suite is about education to do.

    SYNONYM to CREATE or REPLACE table_name for Demo.table_name;

    (3) do the Update statement on the table table_name in Demo1. Updated these results reflected in demo when you post the update statement in Demo1.

    Hope that gives you an idea.

    Kind regards
    Ravi Kumar Ankarapu.

  • reading of the objects in another schema schema

    My requirement is to create a schema and grant privileges to read all objects in another main schema, including the functions and procedures. creating a role and assigning it to the schema will read or select the tables, but she will not allow the user to see the description of a function, or a procedure. can you please tell me what are my options. Thank you.

    Hello

    Yes you can GRANT SELECT privilege to allow access to Tables / views, and GRANT EXECUTE privilege on the procedures in another schema.

    You can also CREATE SYNONYM of these Tables in order to hide their location. There is a way to ensure the transparency of the location, otherwise use views or procedures.

    These links can give you a few tracks on the transparency of the situation and manage privileges:

    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28310/ds_admin006.htm

    http://download.Oracle.com/docs/CD/B28359_01/network.111/B28531/authorization.htm#DBSEG004

    Hope this helps.
    Best regards
    Jean Valentine

  • Update/insert into table in another schema

    Hello

    I have a custom table that is located in another schema used by our dashboard for custom tables. I want to allow users to add/edit users and the security groups for dashboards.

    I see two possible solutions to this issue, I was wondering if anyone has done so and has a better solution or pointers.

    Possible solutions:

    1. move the table to the APEX workspace. Not desirable, would lead to changes in the Production for the pools of connections in the repository.

    2. create a temporary table where you would load the security table data when the user wishes to add/modify records in the security table and then use triggers to update the table by using the synonym to the table.

    Any help would be appreciated.

    Thank you
    Rob

    Modify the procedure to look like to...

    create or replace PROCEDURE UPDATE_TABLE(p_table IN VARCHAR2,
                                             p_column IN VARCHAR2,
                                             p_value IN VARCHAR2,
                                             p_condition IN VARCHAR2)
    AS
    v_sql_stmt VARCHAR2(4000);
    BEGIN
      v_sql_stmt := 'UPDATE ' || p_table || '  SET ' || p_column || ' = ' || p_value || ' WHERE ' || p_condition;
      EXECUTE IMMEDIATE v_sql_stmt;
      COMMIT;
    END UPDATE_TABLE;
    
    {code}
    
    Edited by: Tyson Jouglet on Sep 25, 2008 8:03 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • Import a table from a fullexport to an another schema with a different name

    Hello

    I habe a full export created with expdp. I want to import a table (tkz.verlauf) of this fullexport to another schema (Tom) with another (zzz) name of this table.

    I tried this:

    content = all

    Full = N

    Directory = ORADUMP

    dumpfile = fullexp.dmp

    sqlFile = IMP. SQL

    logfile = IMP.log

    schemas = tkz

    tables = verlauf

    remap_schema = tkz:blubb

    REMAP_TABLESPACE = verlauf:zzz

    But it does not work:

    Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

    Connected to: Oracle 12 c database Release 12.1.0.1.0 - 64 bit Production

    UDI-00010: several work modes, patterns and paintings.

    When I use it without the 'paintings' all tables will be imported.

    Can someone help me?

    Best wishes Jessica

    Hi Jessica,.

    You must just have something like this

    Directory = ORADUMP

    dumpfile = fullexp.dmp

    logfile = IMP.log

    tables is TKZ. Verlauf

    remap_schema = tkz:blubb

    remap_table = verlauf:zzz

    Not sure if you want to rename the table or put a different tablespace (I did rename the table) - replace the last line with rather than table tablespace if you just want it in a different tablespace.

    See you soon,.

    Rich

  • "Getting Started" VM said "ORA-01471: cannot create a synonym.

    People,

    I downloaded the VM with demo integration OGG + ODI for 12.1.3, as well as the PDF "Getting Started with Oracle Data Integrator 12 c". Try step 10.3.2 on pg 92: "Initial running load staged Mapping", but it throws the error message:

    ODI-1228: task Create synonym on target-LKM Oracle for Oracle (DBLINK) - fails when connecting the TRG_ODIDEMO target.

    Caused by: java.sql.SQLException: ORA-01471: cannot create a synonym with the same name as the object

    He told the truth, I tried the code in sqlplus with the same error:

    SQL > conn odi_staging/oracle;

    Connected.

    SQL > create synonym ODI_STAGING. C$ _0OGG_CUSTOMER1 for ODI_STAGING. C$_0OGG_CUSTOMER1@ORCL;

    ERROR on line 1:

    ORA-01471: cannot create a synonym with the same name as the object

    Initially, the definition of database server did not have the Instance = orcl inside, I added and got the same error with and without "orcl". Why is this happening? Another odd piece that may be associated with: I tried this mapping even earlier, and it got stuck on the front line, trying to create a view, but was insufficient privs for ODI_STAGING select the ogg_customer table. So I just did "grant dba to odi_staging;" and that was not enough! Tried stop/start ODI, then the DB without change. Hmmm, s/n role not enough? I've also had "grant select any table of odi_staging;", then this line worked.

    Back to the current problem: I can get the other procs to run, as the Clean Up target tables works very well, and the demo Client works very well.

    (1) anyone has experience this problem of synonym?

    (2) no matter who else get it to work?

    -Thanks, Steve F.

    I got the fix in the product manager. There are two very similar LKMs:

    • LKM Oracle for Oracle (DBLINK) (must be imported)
    • LKM Oracle for Oracle shoot (DB Link). GLOBAL (integrated)

    Of course, they look the same to me except that the second works and one doesn't. In all honesty, the book on pg 89 says 'Pull' in the name. Chalk it up to user error. Detective Conan.

  • Re: "insufficient privileges" error when you run the Java stored procedure in another schema

    I get an "insufficient privileges" error when you run the Java stored procedure in another schema, see details below.  I don't know what are missing privileges (I already granted the EXECUTE privilege), suggestions?  -Thank you.

    Define a simple java class and deploy it as a Java stored procedure to test:


    Schema: User1

    test of the package;

    public class HelloWorld {}

    public HelloWorld() {

    Super();

    }

    public static String Hello () {}

    Return "HELLO";

    }

    }

    CREATE or REPLACE FUNCTION HELLO RETURN VARCHAR2 AUTHID CURRENT_USER AS LANGUAGE JAVA NAME ' test. HelloWorld.hello () return java.lang.String';

    Grant execute on USER2 HELLO

    Test the Java stored procedure through the PL/SQL function call (in the same schema):


    Schema: User1

    SET SERVEROUTPUT ON

    DECLARE

    v_Return VARCHAR2 (200);

    BEGIN

    v_Return: = User1. HELLO;

    DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);

    END;

    anonymous block filled

    v_Return = HELLO

    Test the Java stored procedure through the PL/SQL function call in a different pattern:


    Schema: USER2

    SET SERVEROUTPUT ON

    DECLARE

    v_Return VARCHAR2 (200);

    BEGIN

    v_Return: = User1. HELLO;

    DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);

    END;

    Error report-

    ORA-01031: insufficient privileges

    ORA-06512: at "User1." HELLO', line 1

    ORA-06512: at line 4 level

    01031 00000 - "insufficient privileges".

    * Cause: An attempt was made to change the user name or password

    without the privilege appropriate. This error also occurs if

    trying to install a database without the need for employment

    access privileges.

    When Trusted Oracle is configure in DBMS MAC, this error may occur

    If the user has been granted the privilege necessary for a higher label

    that the connection is active.

    * Action: Ask the database to perform the operation or grant administrator

    the required privileges.

    For users Trusted Oracle get this error, well that granted the

    the privilege that is suitable for the top label, ask the database

    administrator to grant the privilege to the appropriate label.

    You have created the function with AUTHID CURRENT_USER, which means that the function is executed with the rights of the applicant (but not with the rights of the author). This means that the applicant must have grants (directly or through roles) on all used/accessible objects in the service. In your case the user USER2 has not granted with EXECUTE on the class/source Java test. Class HelloWorld, causing the ORA-01031 exception. You create service without AUTHID CURRENT_USER (i.e. with AUTHID DEFINE, which is by default, if you do not have a specific reason to use AUTHID CURRENT_USER) or grant EXECUTE on JAVA test SOURCE. Class HelloWorld to User2.

    Dimitar

  • Insufficient privileges in the creation of MV that he select another schema table

    Hello

    Before asking this question, I checked with similar questions in the forum, but I don't see my situation, or I'd say I'm not clear on the solution.

    I got the privileges CREATE MATERIALIZED VIEW and CREATE ANY MATERIALIZED VIEW and I want to create a MV in my schema, but the MV selects data in another schema, and I had the privilege to choose this table. Here is my code

    Create VIEW MATERIALISEE CPY_GL_HANDS_OFF_DTL

    UPDATE THE BEGINNING WITH THE LARGEST (SYSDATE, TO_DATE ('2013.10.30.23.30.00 ',' YYYY.)) MM DD. HH24.MI. THE NEXT SS SYSDATE')) + (50519 /(24*60*60)) FULL

    ENABLES QUERY REWRITE

    SELECT

    *

    Of

    User_a.GL_HANDS_OFF_DTL@dblink;

    I run it, and I get ORA-01031: insufficient privileges. According to my research so far, the schema of the latter requires the CREATE TABLE privilege, even though she already had RESOURCES (which already includes the CREATE TABLE). Is this true? That's my problem. I only have read access to the table of the dblink, I can't control the privileges of this scheme. Advise please if this is the real problem?

    Thanks and greetings

    acquired through ROLE privileges do NOT apply in the PL/SQL name procedures

  • Drop database link in another scheme that DBA is not working

    How to remove an object for example, database 'MYDB. MYDBLINK"that is present in the SCOTT schema.

    When I try the following options of logged in as DBA , it is in error.

    "DROP DATABASE LINK"SCOTT" MYDB. MYDBLINK1 ';
    ORA-2024: connection to database not found.

    DROP DATABASE LINK SCOTT. MYDB. MYDBLINK1;
    ORA-2024: connection to database not found.

    DROP DATABASE LINK 'SCOTT'.' MYDB. MYDBLINK1';
    ORA-2024: connection to database not found.

    DROP DATABASE LINK SCOTT. MYDB. MYDBLINK1;
    ORA-2024: connection to database not found.

    I always connect like SCOTT to drop the MYDB database link. MYDBLINK1 that is present in the SCOTT schema.

    Please provide the way to drop the database link in another schema, without logging as the schema owner, so that I can connect a DBA (SYSTEM or SYS).

    You cannot remove a database link in the schema of another user. One solution is:

    SQL > CREATE PROCEDURE scott.drop_db_link AS
    BEGIN
    EXECUTE IMMEDIATE 'drop database link LINK1. "
    END drop_db_link; 2 3 4
    7 m

    Created procedure.

    SQL > exec scott.drop_db_link

    PL/SQL procedure successfully completed.

    Source: http://dbaoracletips.blogspot.com/2011/11/how-to-dropcreate-database-link-from.html
    http://laurentschneider.com/wordpress/2012/10/drop-database-link-in-another-schema.html

  • How to share data in the tables ' User_ * ' with another schema

    I want to share the data in the table WHERE USER_SEGMENTS with another schema. If I create a view and grant select on the view, when the other schema queries the view data are identical to themselves querying the SYS.user_segments table directly.
    create view sys_user_segments as select * from sys.user_segments;
    grant select on sys_user_segments to A;
    My guess is that the SYS.user_segments table is a view based on the current user.

    Is there a way to share such data without creating a copy of the table?

    Oracle: 10g

    Thank you

    If the ADMINISTRATOR is concerned about B access to DBA_SEGMENTS (or by creating DBA_SEGMENTS views that belongs to a user who has access on top and then grant access to this view of B), it seems pretty crazy allow that kind of database connection.

    If you create a database link belonged to B that connects to A, B is, in substance, given any privilege that has exercises. But it is done in a very, very dark which will no doubt be neglected in the future when someone gets a check. He'll be sitting here to wait that someone (accidentally or intentionally) Decides to exploit the security hole and do something that is causing a problem (by removing all data from a table, grabbing all the sensitive data in a table, etc.). Risks of this almost certainly far, far* far * outweigh the risks of even leaving B to obtain direct access to DBA_SEGMENTS.

    Justin

Maybe you are looking for