Grant all privs of one schema

Hi,
how i can grant all previleges for user to another user
say i have 2 user A and B
how we can provide all priveleges to user A on user B
Thnaks

That is not really what you said in your original posting. You really need to be a little clearer on your requirements....
Do you want them to have select, update, delete privileges on all the tables?
Do you want them to be able to do execute on any procedure?
Do you want them to be able to select off of any sequences?
Do you need them to be able to access the tables through synonyms?
No matter what you are doing you can probably create a script through the different objects view that will create its own script to grant whatever you want.
Example:
SQL> connect tsb/password
Connected.
SQL> select 'grant select, update, delete on '||object_name||' to scott;' from user_objects
2 where object_type='TABLE';
'GRANTSELECT,UPDATE,DELETEON'||OBJECT_NAME||'TOSCOTT;'
grant select, update, delete on RATE_FACT_TAB to scott;
grant select, update, delete on DIST_RATE_TAB to scott;
grant select, update, delete on CNFGTR_TDE_DIST_RATE to scott;
grant select, update, delete on TIMSJOBS to scott;
grant select, update, delete on TIMSLOCATIONS to scott;
grant select, update, delete on STAGING_TABLE to scott;
grant select, update, delete on STAGING_TABLE_CBINDS to scott;
grant select, update, delete on STAGING_TABLE_CPLANS to scott;
If you spool this then you can execute these as a script or individually.
You can do similar grants with other object types.
The issue will always be that you could run into problems with things such as nested tables and user defined types.
Regards
Tim

Similar Messages

  • All columns of all table in one schema

    Hi
    All,
    Oralce 10.2.0.3
    I want to count all columns in all the table in one particular schema.
    How can I do that?
    which view i should use to count all cloumns of all tables in particular schema?
    Thanks

    vishal patel wrote:
    we needed for our data conversion project..I don't know how you'll use the number of columns in all a schema for data conversion. Some columns are duplicated (e.g. PK/FK), should they really count for two ?
    A data conversion means you should actually know what are the columns used for, not how many they are.
    one more question that count include hidden columns
    what is hidden column used for ? I can not see those columns in actual table.See here an example :
    Re: Difference btwn user_tab_cols & user_tab_columns
    Nicolas.

  • How can count no of rows in all tables in one schema

    hi all
    i want to cound no of rows in my schema ( all tables)
    eg. i have 36 tables
    i want to know no of rows in every tables in only one query through sql or plsql
    how can i do..
    regards
    mohammadi
    Message was edited by:
    Mohdidubai52

    hi
    thanx for ur reply
    but i got error....
    SQL> ED
    Wrote file afiedt.buf
    1 DECLARE
    2 v_rowNo NUMBER := 0;
    3 v_sum NUMBER := 0;
    4 v_tableName VARCHAR2(100);
    5 CURSOR c1 IS
    6 SELECT table_name
    7 FROM user_tables;
    8 BEGIN
    9 FOR counter IN c1 LOOP
    10 DBMS_OUTPUT.PUT_LINE(counter.table_name);
    11 EXECUTE IMMEDIATE 'SELECT COUNT(1) FROM ' || counter.table_name INTO v_ro
    wNo;
    12 v_sum := v_sum + v_rowNo;
    13 END LOOP;
    14 DBMS_OUTPUT.PUT_LINE('Number of rows: ' || v_sum);
    15* END;
    16 /
    DECLARE
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    ORA-06512: at line 11
    again
    thanx
    regards
    Mohammadi

  • Analyze all tables of one schema

    hi,
    the analyze table command is:
    analyze table hr.employees compute statistics;
    Now I want analyze all tables in the hr schema
    how can I do it in a easy way,
    thanks,
    Zhiwei.

    the only way to disable monitoring (globally) is to set statistics_level=basic.Exactly.
    SYS@db102 SQL> select table_name,monitoring from dba_tables
      2  where table_name like 'TEST%';
    TABLE_NAME                     MON
    TEST_P                         YES
    TEST_MV                        YES
    TEST_F                         YES
    TEST11                         YES
    TEST                           YES
    TEST_TABLE                     YES
    TEST_PART                      YES
    TEST_LOB                       YES
    TEST_EMP                       YES
    TESTDECIMAL                    YES
    TEST3                          YES
    TEST1_DL2                      YES
    TEST01                         YES
    13 rows selected.
    SYS@db102 SQL> alter system set statistics_level=basic;
    System altered.
    SYS@db102 SQL> select table_name,monitoring from dba_tables
      2  where table_name like 'TEST%';
    TABLE_NAME                     MON
    TEST_P                         NO
    TEST_MV                        NO
    TEST_F                         NO
    TEST11                         NO
    TEST                           NO
    TEST_TABLE                     NO
    TEST_PART                      NO
    TEST_LOB                       NO
    TEST_EMP                       NO
    TESTDECIMAL                    NO
    TEST3                          NO
    TEST1_DL2                      NO
    TEST01                         NO
    13 rows selected.
    SYS@db102 SQL>                                                                                                            that's what I meant by "in 10g you have to do it explicitly".

  • How to give select prvileges on objects in ONE schema only.

    hi.. i wanna to do gve a select on tables only privilege to all objects in one schema only,
    is there any single command that enable me to do so ?
    or do i have to allocate priviledge to each and every schema objects available ?

    I think there is no command that will give permission on all the objects in one go.
    but u can do it in some tricky way.
    some thing like this
    spool permission.sql
    SELECT 'grant select on '||TABLE_NAME|| ' to abc; ' FROM USER_TABLES
    spool off
    change the abc user with the real schema name
    then run the permission.sql file connected with the user containing the tables.
    first try this on some test db and check if it works
    regards
    Ansh

  • One schema for OWB Design repository, runtime repository and target schema

    Currently we have contents of OWB Design schema, runtime schema and target schema all combined into one schema of the same database in OWB 9.0.2 as well as OWB3i. We like to move to OWB10g in very near future. Can we keep the same structure for convenience of migration in OWB10g? Is it mandatory that OWB design repository (and components) must be separate from OWB run time repository (and components) and target schema? In other words is it possible and workable to use only one schema to contain OWB design repository, OWB run time repository and target schema in OWB10g environment with repositories to be situated on Oracle v9.2.0.1.0? Also what special considerations should be taken to create the database v9.2.0.1.0 and installation of OWB10g. What are the problems/side-effects to have all in one schema?
    Also please let me know how to install Oracle Workflow server to be used along with OWB. Will OWB10g work with repository on Oracle database v9.2.0.1.0?
    Your prompt advice will be very well appreciated.
    Sankar

    The design repo is a metadata repo that stores all the design-time objects and so forth.
    It is an architectural decision that you or your team need to decide on. There are many flexible ways to architect an OWB infrastructure.
    Also, your repository users will be using the design repository on the the other DB instance to do their design work...potentially less people always hitting the target database all the time.
    -Greg

  • Grant to all tables on my schema

    I am fairly new to Oracle and I need to grant "select, update, insert on all mytalbes to roleone, then grant that role to all my users.
    well, I have about 50 tables and 20 users.
    So far the most automated way I have come up with is:
    grant select, update, insert on table1 to role1;
    then I after that, I do:
    grant role1 to userone;
    I am sure there is a way to do this in some sort of procedure. I dont have DBA privs. I own all of the tables on my schema and those are the ones that I need to grant the privs to users.
    would you guys show me how to do this?
    thanks a bunch!

    You have to grant the privileges on each table to the role and then grant the role to each user, so you need 70 GRANT statements. You can write some dynamic SQL to generate the grants, though
    DECLARE
      sqlStmt VARCHAR2(4000);
    BEGIN
      FOR x IN (SELECT * FROM user_tables)
      LOOP
        sqlStmt := 'GRANT SELECT, UPDATE, INSERT ON ' || x.table_name || ' TO role1';
        EXECUTE IMMEDIATE sqlStmt;
      END LOOP;
    END;
    DECLARE
      sqlStmt VARCHAR2(4000);
    BEGIN
      FOR x IN (SELECT * FROM dba_users)
      LOOP
        sqlStmt := 'GRANT role1 TO ' || x.username;
        EXECUTE IMMEDIATE sqlStmt;
      END LOOP;
    END;Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • 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

  • How grant all the privilege of a specific schema to a user?

    How grant all the privilege of a specific schema to a user?
    I already create a new schema and import the neccessary data for that schema.
    Now I want to assign all the privilege for that schema to user HR (let user HR become the owner of that schema). How to deal with it?
    Edited by: qkc on May 13, 2011 10:45 AM

    qkc wrote:
    How grant all the privilege of a specific schema to a user?
    I already create a new schema and import the neccessary data for that schema.
    Now I want to assign all the privilege for that schema to user HR (let user HR become the owner of that schema). How to deal with it?
    Edited by: qkc on May 13, 2011 10:45 AMThere is no way - by definition - that one user can "become the owner" of another schema. A schema is, by definition, the collection of objects that belong to one owner.
    but perhaps that is just semantics in the context of what you really want.
    use sql to build sql:
    spool doit.sql
    select 'grant select on someuser.' || table_name || ' to someotheruser;'
    from dba_tables
    where owner = 'SOMEUSER';
    spool off

  • Travel Schema:grant all privileges

    I have a request to add the travel schema to one of our 9202 databases. Fairly straight forward. I got the *.dmp file from your site:
    http://www.oracle.com/technology/sample_code/tech/java/travel/travelschema.htm#system
    I created the user travel and used the system tablespace as the default. As for privileges, I noticed that I should "grant all privileges" to travel. Is this wise? What's the minimum amount of privileges that I can grant to travel?

    Is this wise? You are quite right to be concerned. Granting ALL PRIVILEGES is a dodgy thing to do. In mitigation I might say that the TRAVEL schema is a sample piece of code and so should only be installed on a development database, where the damage can be limited.
    But I think the real problem is that the sample code was developed by Java programmers who couldn't be bothered to work out exactly what privileges were needed. Shocking, yes, but hardly uncommon. And the poltroons have also included instructions on how to
    To Download and install the travel schema into the SYSTEM tablespace:
    No no no! No application objects go into the SYSTEM schema. What's the point of us non-Oracle people banging on about best practice if their own employees are allowed to post stuff like this on OTN? Sack these bozos!
    What's the minimum amount of privileges that I can grant to travel? I have absolutely no idea. I think the safest thing is to build a new database instance, so that the potential for damage is limited. Alternatively, grant CONNECT and RESOURCE and see how far that goes. You may have to grant additional powers. I see they also grant JAVASYSPRIV and JAVAUSEPRIV. Horrible, simply horrible.
    Cheerse, APC

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • How to export all the views in one schema?

    Hi,
    I have more than 1000 views in one shcema.
    How to export all the views in one schema?
    Amy

    Hi,
    It's not a very easy question, I have develop a script wich create a script to create view from old database to new database :
    /* &1: Oracle SID Source
    /* &2: Oracle Schema Source
    SET HEAD OFF
    SET VERIFY OFF
    SET PAGESIZE 0
    SET LONG 40000000
    SET LONGCHUNKSIZE 2000
    SET LINESIZE 2000
    SET FEEDBACK OFF
    CREATE TABLE RECREATE_VIEW(VIEW_NAME VARCHAR2(30), TEXT LONG);
    /* Selection du texte de la vue */
    DECLARE
    w_text long;
    w_text_debut long;
    w_text_column long;
    w_view varchar2 (30);
    w_schema varchar2 (8):='&2';
    CURSOR w_cursor IS
    SELECT a.view_name, a.text
    FROM dba_views a
    WHERE a.owner = w_schema;
    CURSOR w_column IS
    SELECT DECODE (ROWNUM,
    1, 'CREATE OR REPLACE FORCE VIEW ' || '&' || '1..'
    || a.table_name || chr(10)
    || '('
    || a.column_name
    || DECODE (ROWNUM, nbcolumns, ')' || chr(10) || 'AS' || chr(10), ',' || chr(10))
    FROM (select column_name,table_name
    FROM dba_tab_columns
    WHERE owner = '&1'
    AND table_name = w_view
    order by column_id ) a,
    (SELECT COUNT (1) nbcolumns
    FROM dba_tab_columns
    WHERE owner = '&1'
    AND table_name = w_view
    GROUP BY owner, table_name) b
    order by rownum;
    BEGIN
    OPEN w_cursor;
    LOOP
    FETCH w_cursor INTO w_view, w_text;
    EXIT WHEN w_cursor%NOTFOUND;
    w_text_debut := NULL;
    w_text_column := NULL;
    OPEN w_column;
    LOOP
    FETCH w_column INTO w_text_column;
    EXIT WHEN w_column%NOTFOUND;
    w_text_debut := w_text_debut || w_text_column || ' ';
    w_text_column := NULL;
    END LOOP;
    CLOSE w_column;
    w_text := w_text_debut||w_text||';';
    insert into RECREATE_VIEW(VIEW_NAME, TEXT) VALUES (w_view, w_text);
    COMMIT;
    w_text := NULL;
    w_view := NULL;
    END LOOP;
    CLOSE w_cursor;
    END;
    SPOOL scripts_views_&1..sql
    PROMPT SPOOL scripts_views_&1..log
    PROMPT
    SELECT TEXT
    FROM RECREATE_VIEW;
    PROMPT
    PROMPT SPOOL OFF
    PROMPT
    SPOOL off
    PROMPT /* Formattage du fichier SQL */
    !sed 's/[ ]*$//' scripts_views_&1..sql > aprilia.tmp
    !rm scripts_views_&1..sql
    !mv aprilia.tmp scripts_views_&1..sql
    DROP TABLE RECREATE_VIEW;
    EXIT
    I hope that help you.
    Nicolas.

  • How to know what are the privs for one custom schema?

    how to know what are the privs for one custom schema?
    please suggest me......

    Hi,
    Check this user_sys_privs
    Cheers
    Pavan Kumar N

  • Need to grant DML privileges to all tables in few schemas

    Hi,
    I need to grant DML privileges to all tables in few schemas to a role. How can I achieve that?
    I thought it's below syntax but it doesn't work. Please advice.
    grant ALL ON ALL TABLES IN SCHEMA <Schema_name>  TO <role_name>;Thanks,
    Gangadhar

    GR wrote:
    Hi,
    I need to grant DML privileges to all tables in few schemas to a role. How can I achieve that?
    I thought it's below syntax but it doesn't work. Please advice.
    grant ALL ON ALL TABLES IN SCHEMA <Schema_name>  TO <role_name>;
    There is no single command to grant privileges at that level. There are either ANY privileges or privileges on an object.
    You can write a bit of code to generate and execute what you want, but you would have to rerun it if any new tables were created.

  • Grant select on all table of a schema to role

    Hi , is it possible to grant select on all table on a schema to a role?

    To grant SELECT on all tables of the current schema to particular role or user:
    SELECT 'GRANT SELECT ON '||TABLE_NAME||' TO READ_ONLY_ROLE;' COMMAND
    FROM (
    SELECT TABLE_NAME
    FROM ALL_TABLES
    WHERE OWNER = (SELECT USER FROM DUAL)
    Then copy and execute the result commands, eg:
    GRANT SELECT ON DEPT TO READ_ONLY_ROLE;
    GRANT SELECT ON EMP TO READ_ONLY_ROLE;
    GRANT SELECT ON DEMO_USERS TO READ_ONLY_ROLE;
    GRANT SELECT ON DEMO_CUSTOMERS TO READ_ONLY_ROLE;
    GRANT SELECT ON DEMO_ORDERS TO READ_ONLY_ROLE;

Maybe you are looking for

  • Confused by Hosting

    Hi Can someone help me understand how all this ties together: I have a personal domain and a personal website, the website was created in iWeb, it was published to my personal domain which i guess is hosted with mobileme. Separately, I have bought se

  • Error -WIS10901

    Hi All, While executing a webi report ,on running the query , I get  the error WIS 10901 {MDX query......error } when I try to add more than 1 characterstic in the query.However, it works fine if I add only 1 characterstic to it. Has anyone faced suc

  • Thinkvanta​ge (Access Connection​s) problems

    I have a T41, running XP with 3 different profiles set-up (1 admin and 2 users).  Two days ago, Access Connections will no longer auto launch and connect to our wireless network when signing in with one of the non admin profiles.  Alternatively, if I

  • HT4059 On recent purchases I cannot read the first several chapters due to an error message.

    I downloaded several books from the iBooks store - when opening them I see an error message that says "This page contains the following errors:  error on line 1 at column 1: Document is empty error on line 1 at column 1: encoding error below is a ren

  • How to mark a HTML page as "Out of date"

    Hello! I need a method to prevent the usage of the Back button in web browsers by my web users, and prohibit them to move back through old web pages. During this moving they should view "Page out of date" messages instead of old contents of previous