Select grant to a user

Hello
I'm working on oracle10g and HP - UX.
I need to create only one user on reading, how can select data from other users tabels.

One way to do this - is glove instruction to create a srript...
As

Grant select on UserA.Tb1 to UserB;
Grant select on UserA.Tb2 to UserB;
Grant select on UserA.Tb3 to UserB;

and so on...

There are 4000 tables in the schema UserA... .and we need to write a sql script and run it on the database...

Question-

Is there a way to UserB's Select glove on all the obj. for use in a sql statement...?

N ° there is no single GRANT command. You can, however, write a small script to PL/SQL, i.e.

FOR x IN (SELECT * FROM dba_tables WHERE owner = 'UserA')
LOOP
  EXECUTE IMMEDIATE 'GRANT SELECT ON UserA.' || x.table_name || ' to UserB';
END LOOP;

Of course, you would usually create a new role, grant this role to UserB and grant the privileges to this role, i.e.

CREATE ROLE UserA_Select;

GRANT UserA_Select TO UserB;

BEGIN
  FOR x IN (SELECT * FROM dba_tables WHERE owner = 'UserA')
  LOOP
    EXECUTE IMMEDIATE 'GRANT SELECT ON UserA.' || x.table_name || ' to UserA_Select';
  END LOOP;
END;

In this way, when you need create the next read-only user, you just need to give this user the role of UserA_Select.

Justin

Tags: Database

Similar Questions

  • No line selected even if SELECT granted.

    I have a vision I created OEM 12 c owned by SYSMAN.  The view is as follows:

    create or replace view chk_dbmango as

    Target_name SELECT LOWER (a_size.target_name),

    tphost. HOST_NAME,

    tpba.business_area,

    TPD.contact,

    tpapp.application,

    tpenv. Environment,

    ROUND (AVG (a_size.size_gb), 2) SIZE_GB.

    ROUND (AVG (a_size.used_gb), 2) USED_GB.

    ROUND (AVG (a_size.size_gb - a_size.used_gb), 2) FREE_GB.

    ROUND (AVG ((a_size.used_gb * 100) / DECODE (a_size.size_gb, 0, 1, a_size.size_gb))) USED_PCT

    FROM (SELECT t.target_name,

    t.target_guid,

    SUM (d.tablespace_size) / 1024 / 1024 / 1024 size_gb,.

    SUM (d.tablespace_used_size) / 1024 / 1024 / 1024 used_gb

    Sysman.Mgmt$ db_tablespaces d, sysman.mgmt$ target_type t

    WHERE (t.target_type = "rac_database"

    OR (t.target_type = "oracle_database"

    AND t.TYPE_QUALIFIER3 <>'RACINST'))

    AND d.target_name (+) = t.target_name

    AND t.metric_name = 'tbspAllocation. '

    AND (t.metric_column = "spaceAllocated")

    T.target_name, t.target_guid, t.metric_column) a_size,.

    (SELECT name AS host_name,

    target_guid

    OF sysman.mgmt$ target_properties

    Property_name WHERE = "ComputerName") tphost,.

    (SELECT name AS business_area,

    target_guid

    OF sysman.mgmt$ target_properties

    Property_name WHERE = "orcl_gtp_line_of_bus") tpba,.

    (SELECT name AS the contact,

    target_guid

    OF sysman.mgmt$ target_properties

    Property_name WHERE = "orcl_gtp_contact") TPD.

    (SELECT name as the application,

    target_guid

    OF sysman.mgmt$ target_properties

    Property_name WHERE = "orcl_gtp_comment") tpapp.

    (SELECT name AS the environment,

    target_guid

    OF sysman.mgmt$ target_properties

    Property_name WHERE = "orcl_gtp_deployment_type") tpenv

    WHERE a_size.target_guid = tphost.target_guid

    AND a_size.target_guid = tpba.target_guid (+)

    AND a_size.target_guid = tpd.target_guid (+)

    AND a_size.target_guid = tpapp.target_guid (+)

    AND a_size.target_guid = tpenv.target_guid (+)

    A_size.target_name GROUP,

    tphost. HOST_NAME,

    tpba.business_area,

    TPD.contact,

    tpapp.application,

    tpenv. Environment

    ORDER BY 1;

    I SELECT granted on this point of view of user svcmango.  When it is connected as the svcmango and mode query, I get no selected lines.  Connected as sysman I get 99 lines.  There must be something simple that I forgot.  Help, please.  Thank you.

    I realized that it is.  The Oracle Enterprise Manager Cloud control 12 c database has the active VPD.  Once I understood this point, it was easy to correct the situation.  I just added SVCDBMANGO to the CAE, and all is well.

    Thanks to all for your responses.

    Steve

  • all grants to a user

    Hi all

    Can you me the script share how to list EVERYTHING - all roles, objects, privileges granted to a user? say 'HR' to the user.


    Thank you.

    USER_SYS_PRIVS lists all the system privileges granted to a user

    SELECT privilege
      FROM user_sys_privs
     WHERE username = 'HR'
    

    USER_TAB_PRIVS lists all the privileges granted to a user object

    SELECT owner, table_name, privilege
      FROM user_tab_privs
     WHERE grantee = 'HR'
    

    And USER_ROLE_PRIVS lists all the roles that have been granted to a user

    SELECT granted_role
      FROM user_role_privs
     WHERE username = 'HR'
    

    It may become more complex as of here, however, if you want to list all the privileges granted to these roles, the role given to the roles, privileges granted to these roles, etc. recursively. Fortunately, Pete Finnigan has a handy script that implements this logic. You can go down the script of find_all_privs.sql his site.

    And it becomes much more complicated if you want to grant privileges that do not follow the normal patterns. Privileges of Java, for example, network ACL, Workspace Manager privileges, etc.

    Justin

  • Select a type of user account (for example, standard user, restricted user, and other types) on computer XP pro?

    Hello.

    I have a question about how to select the type of user account for each user account.

    I read that if I type 'control userpasswords2' term, it will bring up a window of hidden user accounts.  In this window, select a name of the user account and click property, click on membership group and it will show all the type of account you can purchase (including the standard user, restricted user, the other who has many other types)

    Here is the link I read

    http://www.exnol.com/globally-control-and-change-all-users-passwords-in-Windows

    Let's say my computer is XP pro and it is in the home (not domain joined ) working group. Am I able to set these types of accounts to my user account using 'control userpasswords2' just as I explained above?

    I was wondering because I read in the microsoft help article or somewhere that it indicates that the computer must be on the field to be able to choose the type of account by using this process, I explained, and one account type you can choose where your computer is located in the Working Group's account admin or limited using the control panel then click on accounts of users... but other said it should not be on the field... I got confused.

    I would like to try it myself, but I don't have XP pro computer with me right now, I'd appreciate it really if someone could help me with the answer.

    Hi greenyy,

    If you are the administrator of the machine Windows XP Professional, you can use the command 'control userpasswords2' and access the list of user accounts and change the type of account.

    You need not necessarily be on a domain, however, it may not work for some types of user accounts on a working group.

    A test, you can try to change the type of account for user accounts & check if it works.

    Reference: To change the type of user account 

    Hope the helps of information. Please post back and we do know.

    Concerning
    Joel S
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Checking roles &amp; sys privs granted to a user.

    Hi all

    11.2.0.1

    Im still confused in many roles and privileges required a user.

    What is the role or sys privs granted to a user, then it can export/import its own table?

    Thank you very much

    zxy

    > so this is something developers and DBA not so it should be granted.

    But how a developer will get create a privilege if operator that is not given to DBA.  Obviously, operator and PL/SQL are used and written by the developer, but they are maintained by DBA at the database level.

    > Unlimited tablespace, what would you say? I did not grant this privilege to HR, but he was able to acquire access unlimited tablespace.

    Because HR user resource. which implicitly grant unlimited tablespace privilege to the user, as I already mentioned, do not use resource to the user it is also recommended by Oracle.  Create your own role, grant privileges system and object required role and now assign this role to the user.

    Concerning

    Girish Sharma

  • Grant to the user API

    Hi team

    someone can tell me how we can grant API Oracle user, really appreciate help.

    Kind regards
    Mahesh

    Mahesh,

    Are you talking about [url http://docs.oracle.com/cd/E23943_01/portal.1111/e10238/pdg_cm_intro.htm#POBLD478] 9.3 providing access to APIs and Secure views?

    In this case, you can use provsyns.sql. Note that the instructions to get the portal password apply to the 10g only. If you want to get on 11g, use the instructions in the Note [url https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=843978.1] 843978.1, "How to recover the portal schema Portal 11g password?".

    Thank you
    EJ

  • OIM11g R2 - if two roles (ACF2 and AD) are selected together for a user req

    Hello

    We are facing a problem in the catalog, if two roles (ACF2 and AD) are selected together for a user and check. The request goes to the approval process. We have not created any approval process workflow.

    Please let me know how to deliver and provide an option to configure two roles at the same time to a user without going into the approval process.

    Steps to reproduce:
    1. create a user in the IOM.
    2. search for this user. Administration-> users-> user to MSN Search
    3. click the "Rôles" tab and select "Request for role" on this tab.
    4. "catalog" tab opens. Click on the search icon and add AD and ACF2 role to the basket.
    5. click on "Check out".
    6. click on the "submit" button
    7 ask tab summary opens with the situation as "Getting Request Approval" and the Type of request as 'assign roles.
    Note: If we assign AD and ACF2 individually to the user and race evaluate user strategies, we are able to see configured state tab account user accounts and demand does not go to the approval process

    Thanks in advance

    Section 2.3

    http://docs.Oracle.com/CD/E27559_01/admin.1112/e27149/appr_policies.htm#CHDFEFCB

  • In the date picker, how can I default to select * dates if the user has...

    In the date picker, how can I default to select * dates if the user does not select a date.
    Thank you
    Doug

    Doug,

    Now lets say l want everything
    

    Could you post some sample data and the output you want to get... ? It would be very easy to understand the requirements...

    When you mean everything, I guess you need all possible dates between date1 and date2.

    You can use... (to asktom.oracle.com).

      1  select to_date('12-jan-2009','DD-MON-YYYY') + rownum -1
      2    from ALL_OBJECTS
      3    where rownum <= (to_date('20-jan-2009','dd-mon-yyyy') -
      4*                     to_date('12-jan-2009','DD-MON-YYYY') +1 )
    sql> /
    
    TO_DATE('
    ---------
    12-JAN-09
    13-JAN-09
    14-JAN-09
    15-JAN-09
    16-JAN-09
    17-JAN-09
    18-JAN-09
    19-JAN-09
    20-JAN-09
    
    9 rows selected.
    
    For your case, since you have date1 and date2...
    
    select to_date(:p12_date1,'DD-MON-YYYY') + rownum -1
      from ALL_OBJECTS
      where rownum <= (to_date(:p12_date2,'dd-mon-yyyy') -
                        to_date(:p12_date1,'DD-MON-YYYY') +1 )
    

    Should work... in my opinion... Have not tested the other by their Summit.

    Is that what you're looking for... ?? If no, please give details...

    Thank you
    Rajesh.

  • question on the granting of select for a test user

    Hi all

    I have a question, lets say

    (1) I create a test user and it connects to my database ORCL
    (a) create test user identified by the test (using the user sys)
    (b) I grant it the create session test user privilege (using the user sys)

    (2) now, I want the sys user to grant select on table of hr.countries for the TEST user

    Question: everything first is it possible? If yes how?

    Thanks and greetings
    Rahul

    Mac_Freak_Rahul wrote:
    My version of oracle:

    Query: SELECT * FROM v version $;

    BANNER

    Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
    PL/SQL Release 9.0.1.1.1 - Production
    CORE 9.0.1.1.1-Production
    AMT for 32-bit Windows: Version 9.0.1.1.0 - Production
    NLSRTL Version 9.0.1.1.1 - Production

    ----------------------------------------------------------------------------------
    know the user (as you say I'm out of the query): select user of double;

    Released: user

    PS: During indexing through Toad, I'm 100% sure I connect with the sys as sysdba user

    -----------------------------------------------------------------------------------
    statement: GRANT SELECT ANY TABLE, GRANT ANY OBJECT TO test1;
    gives me an error: invalid or missing privilege

    There is no 'GRANT ANY OBJECT' privilege in version 9.0.1 (or any other version, AFAIK)

    http://download.Oracle.com/docs/CD/A91202_01/901_doc/server.901/A90125/statements_913.htm#2062195

    PS: test1 is a user that I created using the statement: create user test1 identified by test1, and then using the user "sys" I granted a privilege create user test1 session
    -------------------------------------------------------------------------------------

    My request still pending, but I must say that when I ask questions here that I had incredible answers to a lot of guys who are very knowledgeable. Help, please

    Concerning
    Rahul

    Srini

  • Select grant to user only to some columns. Is this possible?.

    Good night:

    I learn about the roles and privileges.

    I tried to limit the right to select on a table for only some columns of it.
    Unfortunately, it does not work.

    GRANT select (employe_id, last_name, job_id)
    ON hr.employees
    To Usuario_2;

    It is an ORA-00969: falta the word clave market (ON the keyword is missing)

    Surprisingly, it does not work with updates.

    Update (employe_id, last_name, job_id) GRANT
    ON hr.employees
    To Usuario_2;

    "Treated phrase."

    Could someone tell me if it is possible access of the users with 'select' only some columns do not use views? If its possible. What I am doing wrong?

    Greetings

    You can't give Annie with specific column. You can do so only to updating, inserting, and references.
    Other ways is to use the DPV or views (but SPV is not the XE version)

    You can read this topic: GRANT SELECT on the selected columns

    Edited by: AndyPol 2010-02-01 23:48

  • Users and SELECT GRANT

    Hello.

    Thank you for reading my post.

    Can take you a look at what I've done?

    ---------------------------------------------------------------------------------------------------------------
    SQL > connect sys as sysdba
    ---------------------------------------------------------------------------------------------------------------
    SQL > CREATE TABLESPACE tbp
    DATAFILE 'c:\app\oracle\thepath\tbp.dbf '.
    SIZE 1000M
    DEFAULT STORAGE INITIAL (50M
    NEXT 50 M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0);
    ---------------------------------------------------------------------------------------------------------------
    SQL > CREATE ROLE rol;
    ---------------------------------------------------------------------------------------------------------------
    SQL > GRANT CREATE SESSION, CREATE TABLE TO rol;
    ---------------------------------------------------------------------------------------------------------------
    SQL > CREATE USER IDENTIFIED BY usr usr
    TABLESPACE default tbp
    TEMPORARY TABLESPACE thetemp
    QUOTA UNLIMITED ON tbp;
    ---------------------------------------------------------------------------------------------------------------
    SQL > GRANT rol to usr;
    ---------------------------------------------------------------------------------------------------------------
    SQL > CREATE USER IDENTIFIED BY usr2 usr2
    TABLESPACE default tbp
    TEMPORARY TABLESPACE thetemp
    QUOTA UNLIMITED ON tbp;
    ---------------------------------------------------------------------------------------------------------------
    SQL > connect usr
    ---------------------------------------------------------------------------------------------------------------
    SQL > CREATE TABLE radios (name varchar2 (20) varchar2 (20)) frequency;
    ---------------------------------------------------------------------------------------------------------------
    SQL > INSERT INTO radios that have VALUES ("radio1", ' 15515.55' ");
    ---------------------------------------------------------------------------------------------------------------
    SQL > GRANT SELECT ON radios to usr2;
    ---------------------------------------------------------------------------------------------------------------
    SQL > connect usr2
    ---------------------------------------------------------------------------------------------------------------
    SQL > SELECT * FROM radios;
    Select * radio
    *
    ERROR on line 1:
    ORA-00942: table or view does not exist
    ---------------------------------------------------------------------------------------------------------------


    And indeed:
    ---------------------------------------------------------------------------------------------------------------
    SQL > select * from user_objects where type_objet = "TABLE";
    no selected line
    ---------------------------------------------------------------------------------------------------------------


    Don't you see what is my problem?
    I wish "usr2" could have "SELECT" success on table "radio".
    Can you explain to me what's wrong with my reasoning?

    Thank you and best regards,
    --
    Lmhelp
    [Database 11g Enterprise Edition Release 11.1.0.6.0 http://Oracle]

    Select * from usr.radios;

    You must use schema_name. to access the object object_name.

    Concerning
    Asif Kabir

    3 (3 pending)
    -Mark your answer as correct/useful.

    Published by: asifkabirdba on December 8, 2009 17:17

  • System to grant to the user of the application views

    Hi all

    11.2.0.1

    Batch process Tha night encounter problem blocking where their generations report affected and delayed.

    I give this command operators, so that they will kill or stop the process that keeps the lock:

    SELECT TO_CHAR ("sysdate, ' HH24:MI:SS of MON-DD-YYYY"). ' The user '. S1. UserName | | » @'|| S1.machine | | "(SID = ' | s1.sid |)

    ') with the statement: ' | sqlt2.sql_text | |' if it blocks the SQL statement ' | S2. UserName | | » @'|| S2.machine |

    ' (SID ='|) S2.SID | |') Blocked-> SQL ' | sqlt1.sql_text AS blocking_status

    GV $ lock l1, Gv$ session s1, Gv$ lock Gv$ session s2, l2, Gv$ sqlt2, Gv sql $ sql sqlt1

    WHERE s1.sid = l1.sid

    AND s2.sid = l2.sid

    AND sqlt1.sql_id = s2.sql_id

    AND sqlt2.sql_id = s1.prev_sql_id

    AND l1. BLOCK = 1

    AND l2.request > 0

    AND l1.id1 = l2.id1

    AND l2.id2 = l2.id2;

    But this needs system views and you can not run the app user ID.

    On the security audit decision or without having violated, what I have to grant select to all system views accessed by this script to the user of the application, then create synonyms it 1 by 1?

    Or is it a one-time grant for all views of the system? So I is not need to type a plus creating synonyms so that I can't miss any?



    Thank you

    Petra k.

    f55237a7-2c38-4DB3-a7a3-1d77256f0730 wrote:

    Hi all

    11.2.0.1

    Process batch Tha night meets lock problem where their generations report interrupted.

    I give this command operators, so that they will kill or stop the process that keeps the lock:

    SELECT TO_CHAR ("sysdate, ' HH24:MI:SS of MON-DD-YYYY"). ' The user '. S1. UserName | | » @'|| S1.machine | | "(SID = ' | s1.sid |)

    ') with the statement: ' | sqlt2.sql_text | |' if it blocks the SQL statement ' | S2. UserName | | » @'|| S2.machine |

    ' (SID ='|) S2.SID | |') blocked SQL-> ' | sqlt1.sql_text AS blocking_status

    GV $ lock l1, Gv$ session s1, Gv$ lock Gv$ session s2, l2, Gv$ sqlt2, Gv sql $ sql sqlt1

    WHERE s1.sid = l1.sid

    AND s2.sid = l2.sid

    AND sqlt1.sql_id = s2.sql_id

    AND sqlt2.sql_id = s1.prev_sql_id

    AND l1. BLOCK = 1

    AND l2.request > 0

    AND l1.id1 = l2.id1

    AND l2.id2 = l2.id2;

    But this needs system views and you can not run the app user ID.

    In view of the security check or without having violated, what I give select all system views accessed by this script to the user of the application, and then create the names it 1 by 1?

    Or is it a one-time grant for all views of the system? So I no need to type one by one so that I can't miss any?

    Thank you

    Petra k.

    While approach posted will work subsequently, it's like making three left turns around the block;

    instead of making a single term of law.

    Place the SQL desired in a procedure (FIND_LOCKER) owned by the extremely privileged schema; then do as below

    GRANT EXECUTE ON FIND_LOCKER TO OPERATOR_USER;

  • On the SELECTION of the MAIN USER SCREEN,...

    ......... I can't select the option user Accounts_logon logon Welcome screen options on my Windows XP Professional. When I select the task to "change the way users log on or off", I get a warning message, stating: "services Client for Netware has disabled the Welcome screen and the fast user switching. To restore, uninstall services Client for Netware. How do we uninstall services Client for Netware? I disabled this service in the administrative tools_Services. but... I'm afraid acsess TOOLS WITHOUT administrative SUPPORT.

    Hello

    I suggest to try the given steps and check if it helps.

    Error message when you try to turn on welcome screen or Fast User Switching:

    http://support.Microsoft.com/kb/315347

    Hope this information is useful.

  • Windows 7 - after selecting a USER, the computer opens the selection screen of the USER - code throws again: 2000-0146 to diagnosis

    Computer seems to boot correctly.  Once a USER is selected in the USER SELECTION screen, the computer seems to proceed... but then the USER SELECTION screen opens again.  When you run the Diagnostic tests, the only error is 2000-0146

    Hello

    Thanks for posting your question on the Microsoft forums.

    I understand that you have a problem on your Windows 7 computer. I would certainly help with this question.

    This problem started after the recent update installation of Windows?

    Some members of our community have reported similar problems after the recent update of Windows KB3097877 installation on

    their Windows 7-based computer. The update has been re-released, uninstall and reinstall the update can help us get this problem is resolved.

    In order to solve the problem, I suggest you try the steps posted by Akil P responded on November 13, 2015 in the following thread and check if the steps help you to solve the problem.

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-update/flickering-screen-and-sign-in-problems-on-Windows/df9c8255-587f-4DBF-BB45-6639b29dc4ae?TM=1447375680761

    Hope this information is useful. Let us know if you need additional assistance, we will be happy to help you. ___

    _____________________

    Thank you best regards &,.

    Isha Soni

  • Cannot select the Dictionary view user USER_TAB_COMMENT?

    Hello.

    I have this weird problem in 11.2.0.3

    I cannot select the view of the USER_TAB_COMMENT of a user dictionary, but others can.
    If I try to describe it, I get ORA-00942 and ORA-04043 messages.

    Here is my attempt. I create a comment on a table, try desc or select the view from the dictionary. Then connect with SYS and select the comment in the view "dba" to check if the comment was created:
    SQL> conn RODOLFO
    Introduzca la contraseña:
    Conectado.
    SQL> show user
    USER es "RODOLFO"
    SQL> comment on table DOCUMENTILLOS is 'This is a comment';
    
    Comentario creado.
    
    SQL> select table_name, comments from user_tab_comments;
    select table_name, comments from user_tab_comments
                                     *
    ERROR en línea 1:
    ORA-00942: la tabla o vista no existe
    
    SQL> desc user_tab_comments;
    ERROR:
    ORA-04043: el objeto "SYS"."DBA_TAB_COMMENTS" no existe
    
    
    SQL> desc all_tab_comments;
    ERROR:
    ORA-04043: el objeto "SYS"."DBA_TAB_COMMENTS" no existe
    
    
    SQL> conn / as sysdba
    Conectado.
    SQL> show user
    USER es "SYS"
    SQL> select owner, table_name, comments from dba_tab_comments
      2  where owner = 'RODOLFO' and table_name = 'DOCUMENTILLOS'
      3  ;
    
    OWNER                          TABLE_NAME
    ------------------------------ ------------------------------
    COMMENTS
    --------------------------------------------------------------------------------
    RODOLFO                       DOCUMENTILLOS
    This is a comment
    
    
    SQL>
    Other users, I don't have this problem
    SQL> conn MANOLO
    Introduzca la contraseña:
    Conectado.
    SQL> show user
    USER es "MANOLO"
    SQL> comment on table DOCS is 'This is a comment';
    
    Comentario creado.
    
    SQL> select table_name, comments from user_tab_comments where table_name = 'DOCS';
    
    TABLE_NAME
    ------------------------------
    COMMENTS
    --------------------------------------------------------------------------------
    DOCS
    This is a comment
    Clues why this is happening?

    Kind regards.

    elvegaa_esp wrote:
    What do you think?

    OK, the question is in the place where he is not pointing?

    Edit:
    Oh, it looks that it points to dba_tab_comments. Since your original post:

    desc user_tab_comments;
    ERROR:
    ORA-04043: el objeto "SYS"."DBA_TAB_COMMENTS" no existe
    

    Who do not have the right of Rodolfo.

    Thus, final to get rid of him.

    And a good thing that you do not 'go to your DBA"as suggested. It was just to choose the wrong solution to an unknown problem.

    Concerning
    Peter

    Published by: Peter on March 11, 2013 08:49

Maybe you are looking for