INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

giving user rights to access another schema

giving user rights to access another schema

(OP)
Hi,
I have created a USER and want to give rights to this USER to access tables, procedures from another schema.
The user should have rights only to read, write, delete, insert records, execute procedure.
User should not be allowed to create/drop table.

How can I do this as I am new to DBA.

TIA,
RAJ

RE: giving user rights to access another schema

you have to grant the rights on every object in the other schema. The grants must be issued by the other schema user

grant select,insert,update,delete on my_table to new_user;
grant select on my_sequence to new_user;
grant execute on my_procedure to new_user;

Bill
Lead Application Developer
New York State, USA

RE: giving user rights to access another schema

Try something like this:

CODE

DEF Owner_='SCOTT'
DEF Newusr='NewUser'
SET LIN 120 PAGES 0 TERM OFF ECHO OFF VER OFF
SPO Grant_ddl.sql
SELECT CASE
            WHEN Otype = 'TABL'
            THEN
                  'GRANT SELECT, INSERT,UPDATE,DELETE ON '
                || Owner|| '.'|| Oname|| ' TO &&NewUsr;'
            WHEN Otype IN ( 'VIEW', 'SEQU' )
            THEN
               'GRANT SELECT ON ' || Owner || '.' || Oname || ' TO &&NewUsr;'
            WHEN Otype IN ( 'PROC', 'FUNC' )
            THEN
               'GRANT EXECUTE ON ' || Owner || '.' || Oname || ' TO &&NewUsr;'
         END
            AS Ddl
  FROM ( SELECT Owner, SUBSTR ( Object_Type, 1, 4 ) Otype, Object_Name Oname
           FROM Dba_Objects
          WHERE Owner = 'OWNER_'
            AND ( Object_Type IN ( 'TABLE', 'VIEW', 'SEQUENCE' )
             OR SUBSTR ( Object_Type, 1, 4 ) IN ( 'PROC', 'PACK', 'FUNC' ) ) )
ORDER BY 1 Desc;
SPO OFF
SET ECHO ON
@@Grant_ddl 
3eyes

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close