Grant access to all object/tables in other schemas to a user

Is there any and simple way to grant access to all object/tables in other schemas (more than one) to a scheme/user?
Thanks.
Tarman.

HI.
grant SELECT ANY TABLE,delete any table, insert any table to user; Giving this delete,insert ANY TABLE privilege to a user can be dangerous and the use can mislead it. Its better to create a dynamic script and then grant it.
E.g Suppose you want to give select,inert,delete,update privileges to user A on user B's object.
sql> spool grants.sql
sql> select 'grant select,insert,update,delete on '||owner||'.'||table_name||' to A;' from dba_tables where owner='B';
sql>@grants.sqlHTH
Anand

Similar Messages

  • How to grant privileges on all the tables in a schema

    Hi All,
    Can you tell me how to grant privileges on all the tables of a schema A
    to schema B.
    For Example:
    There are 200 tables in schema A, I wanted to grant select privilege on all the tables of a scheme A to schema B.
    Thanks in advance.

    note that USER is the user that will have the select priviledge
    the procedure includes views as well
    CREATE OR REPLACE PROCEDURE GRANT_ACCESS_ON_USER IS
    CURSOR c1 is select table_name from user_tables;
    CURSOR c2 is select view_name from user_views;
    tablename user_tables.TABLE_NAME%TYPE;
    viewname user_views.VIEW_NAME%TYPE;
    BEGIN
    tmpVar := 0;
    OPEN c1;
    loop
         fetch c1 into tablename;
         EXIT WHEN c1%NOTFOUND;
         EXECUTE IMMEDIATE 'GRANT SELECT on '||tablename ||' to USER';
    end loop ;
    close c1;
    OPEN c2;
    loop
         fetch c2 into viewname;
         EXIT WHEN c2%NOTFOUND;
         EXECUTE IMMEDIATE 'GRANT SELECT on '||viewname ||' to USER';
    end loop ;
    close c2;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
    -- Consider logging the error and then re-raise
    RAISE;
    END;
    /

  • Grant permission to all objects of a schema to apps user(Oracle 10g)

    Dear Fiiends,
    I would like to grant permission on all objects of a particular schema to apps user(Oracle 10g).How do I do it?
    (ex)grant all on <schemaname>.<objectname> to apps with grant option.
    This is the permission i want to give but i can't do it for all objects one by one so how do i do it in a single command.
    Regards,
    Arun

    You can't do it in a single command. You have to give object-by-object privileges (you could grant something like SELECT ANY TABLE, but that applies to every schema in the database and is generally a rather bad idea). You can, however, use a bit of dynamic SQL to do the job, i.e.
    FOR x IN (SELECT * FROM user_tables)
    LOOP
      EXECUTE IMMEDIATE 'GRANT ALL ON schema_name.' || x.table_name || ' TO apps WITH GRANT OPTION';
    END LOOP;You can do the same with other object types, hit DBA_TABLES rather than USER_TABLES if you don't want to run this as the object owner, etc.
    Justin

  • What is table where we can have access to all objects in a order

    Hi all,
    could you tell me what is the table name where i can get access to all objects to an order in crm..

    check CRMD_LINK

  • Grant access to all the views created in user schema to another schema

    How to grant access for all the views created in own HAGGIS schema to comqdhb schema on the HAGGIS database.
    Oracle Grant Privileges
    ===============
    Object privileges assign the right to perform a particular operation on a specific object
    I read that we can use select 'grant select on' ||view_name||'HAGGIS' user_views where owner='COMQDHB'
    Is this right
    Oracle System Privileges
    ===============
    System privileges should be used in only cases where security isnt important,because a single grant statement could remove all security from the table
    Role based security
    ============
    Role security allows you to gather related grants into a collection-since the role is a predefined collection of privileges that are grouped together.privileges are easier to assign to users.
    [http://www.dba-oracle.com/art_builder_grant_sec.htm]
    can we grant select update to all the views at a time to the other schema.
    Are there any other ways to secure the data other than creating users and assigning roles.
    Thank you
    Edited by: Trooper on Dec 23, 2008 9:24 AM

    I think what was suggested was that you use SQL to generate the grants on each and every view, that is, you use SQL to generate SQL where the SQL being generated is "grant select on view_name to role'"
    If you users to connect to Oracle you have to create usernames for them though if the users only connect via an application the application might run just as one user and access to the application is controled via application security. The control on the application can be via Directory Services such as OID or MS Active Directory. User access to Oracle can also be controlled via OID.
    To connect to Oracle you can use OS authenication (not recommended), usernames with passwords, or via Advanced Security Option which supports single sign-on products like Kebros or Oracle Internet Directory etc....
    Example using SQL to generate SQL
    How do I find out which users have the rights, or privileges, to access a given object ?
    http://www.jlcomp.demon.co.uk/faq/privileges.html
    HTH -- Mark D Powell --

  • How to find accurate number of Rows, and size of all the tables of a Schema

    HI,
    How to find the accurate number of Rows, and size of all the tables of a Schema ????
    Thanks.

    SELECT t.table_name AS "Table Name",
    t.num_rows AS "Rows",
    t.avg_row_len AS "Avg Row Len",
    Trunc((t.blocks * p.value)/1024) AS "Size KB",
    t.last_analyzed AS "Last Analyzed"
    FROM dba_tables t,
    v$parameter p
    WHERE t.owner = Decode(Upper('&1'), 'ALL', t.owner, Upper('&1'))
    AND p.name = 'db_block_size'
    ORDER by 4 desc nulls last;
    ## Gather schema stats
    begin
    dbms_stats.gather_schema_stats(ownname=>'SYSLOG');
    end;
    ## Gather a particular table stats of a schema
    begin
    DBMS_STATS.gather_table_stats(ownname=>'syslog',tabname=>'logs');
    end;
    http://www.oradev.com/create_statistics.jsp
    Hope this will work.
    Regards
    Asif Kabir
    -- Mark the answer as correct/helpful

  • Cannot display all the tables of the schema!!!

    Hi:
    I use the oracle sql developer on the windows xp, I found that the tables tab cannot display all the tables of the schema owner, I use the sql "select count(*) from user_tables" I found the result is more than the tab can be display, and I also press the "show more" already.... does anyone can help me ???

    Similarly, I have 852 tables owned by the connected user (selected count from user_tables and checked the user tables report which has this many records returned), but when I double-click on the "Show More" and select Show All, I only get approximately 375 tables listed.
    It doesn't help that the sorting is different - ie ASF_ comes before ASFB in the connection pane but the other way around in the report.
    However, it looks as though the problem is that tables that are not analysed (based on the report data in DATE_LAST_ANALYZED) are not being displayed under the Table node.

  • Privilege for truncating a table of other schema

    Hi friends
    I need to truncate a table of other schema. What privilege the other user has to give to carry out it.
    Thanks
    Edited by: user12892846 on 01-abr-2010 15:59

    DROP ANY TABLEWhile technically correct, above is somewhat dangerous because every schema could be impacted; even SYS.
    Assume SCHEMA_A owns TABLE_A & procedure below.
    CREATE & REPLACE PROCEDURE TRUNCATE_TABLE_A
    AS
    BEGIN
    EXECUTE IMMEDIATE 'TRUNCATE TABLE TABLE_A';
    END TRUNCATE_TABLE_A;
    GRANT EXECUTE ON TRUNCATE_TABLE_A TO SCHEMA_B;
    By doing as above SCHEMA_A can control who & which table(s) can be impacted (in is own schema only).
    Edited by: sb92075 on Apr 1, 2010 7:06 PM

  • Can a procedure select data from tables on other schemas?

    Can a procedure select data from tables on other schemas?
    If it is posible, which syntax should I use to identify the tables and schemas on the SELECT query?

    Yes , it is possible..unless the current user has the right privileges on others' db objects schema.
    Now , as regards the syntax....
    1) The more descriptive way is to use the format ... <owner_schema>.<obj_name>.
    2) If you have declared public synonyms of other schema's objects then you can refer to them as just <obj.name>.... but the <owner_schema>.<obj_name> is not wrong.
    3) If the db objects reside on another database you must have declared a db link.... then the syntax is <owner_schema>.<obj_name>@<db_link_name>.
    Regards,
    Simon

  • Grant privileges to all objects

    Oracle 11.0.1.7.0:
    When I create new user I do something like:
    create user abc identified by abc
    grant create session, create table, create views, create snapshot to abc - separate grant for each object
    grant unlimited tablespace to abc;So when I do that sometimes I forget privileges for sequences. Is there a way to give privilege in one sql to the user to let that user create table, views, session, tablespace etc.
    Edited by: user628400 on Jun 9, 2009 5:35 PM

    Is there a list of things like create table, session etc. that I can look at to determine what options I have?select distinct privilege from role_sys_privs order by 1;
    will give you a list of privileges which can be granted to role.
    is there a way to grant privileges to all different types like create table, session etc in one statement without having to type each one of them separately like grant create session, grant table?As other replied, this can be achieved by creating a role like:
    SQL> create role newrole;
    Role created.
    SQL> grant create table,query rewrite to newrole;  -- Or any privilege by above command.
    Grant succeeded.
    SQL> grant newrole to <YourUserName>;  --
    Grant succeeded.HTH
    Girish Sharma

  • ORACLE - How to GRANT privilegies on ALL the tables belonging to a schema

    Is there a way to grant to a user the same privilegies on ALL the tables belonging to the same schema, so that, in case a new table is created afterwards, the grant is automatically given ?
    Thanks in adance for any reply

    Yes of course ! Just do the same as Oracle Applications: an end user has no Oracle account, the application code connects with the Oracle account that is the schema owner:
    no more grant needed ... That's a joke but it's also true ! In this case, your application must implement its own security (password management, audit, privileges) and you will not be able to use Oracle privileges, auditing and advanced security features ... just like Oracle Applications.
    The above answers are of course correct. You can also create an Oracle role that you can grant to the Oracle users and grant the privileges to this role everytime a new table is created to avoid granting privileges for each new object to each user.

  • How to GRANT SELECT on all the tables in 1 go?

    Hi
    I have many tables (close to 200) in my Schema. I want to grant SELECT ON ALL TABLES to another user. How do I achieve this in one go?
    Thanking you in advance,
    ...

    Although Justin has given a wonderful answer. You might also review the following threads;
    Grant select on a schema
    Re: Grant select on a schema
    grant select on
    grant select  on
    grant select on tables
    Re: grant select on tables
    Adith

  • ORA-01031: insufficient privileges when creating a table in other schema

    Dear all,
    I appreciate your help please in this issue :
    when i try to issue the below statement to create a table in an another schema than the user i am connected in
    CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
    SELECT *
    FROM HST
    WHERE 1 = 0;
    I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
    What other privileges should i grant also,
    Please if you have any idea.

    user562674 wrote:
    Dear all,
    I appreciate your help please in this issue :
    when i try to issue the below statement to create a table in an another schema than the user i am connected in
    CREATE TABLE SCHEMA_NAME_B.HST_ARCH nologging AS
    SELECT *
    FROM HST
    WHERE 1 = 0;
    I always get ORA-01031: insufficient privileges error, even if i have granted the create table privilege to the user i am connected in.
    What other privileges should i grant also,
    Can you show us a cut/paste from the sql*plus of session of yours which should show that you have given the privilege directly to this user and after that the command fails?
    Aman....

  • Creating views in a new schema to access certain rows of tables in source schema

    Hi,
    Oracle 10.2.0.4
    We are trying to mask certain data from some users. My suggestion is that we create a new schema view_schema on the same instance where we have source tables say in source_schema.
    We then create views in view_schema as below
    CREATE VIEW AS SELECT * FROM source_schema.table where COLUMN_n = 'XYZ';
    we then grant SELECT on these views to a role and assign new users that role to be able to see the viewed data.
    So the questions below.
    We can create views to look at data in another schema WITHOUT giving SELECT permissions directluy on source_schema.tanle?
    This will work and there is no need to create synonyms etc
    WE can manage users and views much easilier
    Does this make sense and would that be better than selecting views with say table_name_view in source schema for this purpose and even creating synonyms for these views with the same tanle names in sourece_schema?
    Thanks

    905989 wrote:
    Hi,
    Oracle 10.2.0.4
    We are trying to mask certain data from some users. My suggestion is that we create a new schema view_schema on the same instance where we have source tables say in source_schema.
    We then create views in view_schema as below
    CREATE VIEW AS SELECT * FROM source_schema.table where COLUMN_n = 'XYZ';
    we then grant SELECT on these views to a role and assign new users that role to be able to see the viewed data.
    So the questions below.
    We can create views to look at data in another schema WITHOUT giving SELECT permissions directluy on source_schema.tanle?
    This will work and there is no need to create synonyms etc
    WE can manage users and views much easilier
    Does this make sense and would that be better than selecting views with say table_name_view in source schema for this purpose and even creating synonyms for these views with the same tanle names in sourece_schema?
    Thanks
    1. You can create the view in another schema (first granting privileges to the view schema) without granting privileges from the source schema
    2. You probably want to create public synonyms for the view(s).  You can refer to the view as schema.view but this is cumbersome
    3. I am not sure about management being easier but added complexity should not be too bad.  Write documentation describing how everything works and the object involved.
    Another, more complicated but more powerful possibility is to use row level security also known as virtual private database - if you have the license.  You create a profile for a table and a procedure to generate WHERE clauses to filter any query against the table and columns defined in the profile.  Again, you need the license to do this.

  • Do I need to reapply grants and synonyms. Altering Rename for other schema

    Hi,
    We are following the process to replace some tables in UAT/PROD with new structure of tables.
    So for example for Table A in Schema A:
    Step1- Create TableA_NEW with the required structure and partitions.
    Step2- Insert into TableA_NEW Select * from TableA.
    Step3- Alter Table TableA Rename to TableA_OLD --Take Backup of TableA
    Step4- Alter Table TableA_NEW Rename to TableA --Change the New table ti Original Table
    Now do I need to reapply all the grants and synonyms originally applied to TableA.
    When I test in Dev, all the grants and synonyms still hold. But I can't take any chances for UAT/PROD.
    Also when I rollback these changes and Rename the tables back to Original table.
    Then do I need to Reapply all the grants and synonyms originally applied to TableA.
    Please suggest..

    user8941550 wrote:
    Hi,
    We are following the process to replace some tables in UAT/PROD with new structure of tables.
    So for example for Table A in Schema A:
    Step1- Create TableA_NEW with the required structure and partitions.
    Step2- Insert into TableA_NEW Select * from TableA.
    Step3- Alter Table TableA Rename to TableA_OLD --Take Backup of TableA
    Step4- Alter Table TableA_NEW Rename to TableA --Change the New table ti Original Table
    Now do I need to reapply all the grants and synonyms originally applied to TableA.
    When I test in Dev, all the grants and synonyms still hold. But I can't take any chances for UAT/PROD.
    Also when I rollback these changes and Rename the tables back to Original table.
    Then do I need to Reapply all the grants and synonyms originally applied to TableA.
    Please suggest..
    Step1- Create TableA_NEW with the required structure and partitions. New table - does not have grants
    Step2- Insert into TableA_NEW Select * from TableA.
    Step3- Alter Table TableA Rename to TableA_OLD --Take Backup of TableA Renamed table keeps grants. Synonym not valid at this point
    Step4- Alter Table TableA_NEW Rename to TableA --Change the New table ti Original Table New table still does not have grants, synonym now valid
    So, grants disappear but synonym will be valid at end of process.

Maybe you are looking for

  • ITunes 7 bug in album display

    I like the new display modes, but I've noticed a bug. If you are in the list mode, sorted by anything other than album, and then go into one of the two album modes, you get multiple copies of each album, many with one song in each. If the list mode i

  • NFC doesn't turn on

    I followed the instructions to turn on the NFC on my Tablet Z, but it doesn't turn on. The NFC icon doesn't show up at the top bar, and it doesn't recognize other NFC devices at all. What can I do? Is it a hardware issue?

  • Username and password for 8i lite

    I'm running Oracle 8i Lite on NT 4.0. I've just installed 8i Lite and it asks for username and password. Anyone knows if it takes any default username and password? I was using the same username and password that I use to log into OTN web site, but i

  • Is there an update to make Acrobat Pro 6.0 compatible with Windows 7?

    I have been using Adobe Acrobat Professional 6.0 on a Windows XP OS, but as of 4/8/2014 XP is no longer supported. So, I did Easy Transfer from XP to a computer using Windows 7. When I installed my Adobe Acrobat Professional 6.0 software on the Windo

  • I have a full sketch in Illustrator that I want to make symmetrical, how do I go about doing this?

    Hey guys, I'm somewhat new to Illustrator and I have a scanned in sketch of a man's face that I would like to make perfectly symmetrical.  How do I go about doing this? Thanks in advance!