If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > grant select ... ( or any other objects )

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-20-04, 04:42
bab bab is offline
Registered User
 
Join Date: Feb 2004
Posts: 37
grant select ... ( or any other objects )

hi all,

how can i grant "select" on all tables in schema x to a user y without listing all names of tables in schema x ...

GRANT SELECT ON TABLE x.tab1 TO USER y;
GRANT SELECT ON TABLE x.tab2 TO USER y;
GRANT SELECT ON TABLE x.tab3 TO USER y;
GRANT SELECT ON TABLE x.tab4 TO USER y;
....
....
and so on ...


is there any commands like :

GRANT SELECT ON TABLE x.ALLTABLE TO USER y; ?????? !!!!

thanks a lot
Reply With Quote
  #2 (permalink)  
Old 02-20-04, 04:52
Walter Janissen Walter Janissen is offline
Registered User
 
Join Date: Nov 2003
Location: Germany
Posts: 62
Hi

In DB2 V7 z/OS this is not possible. You can grant privileges on the database level, which include the SELECT-privilege. Unfortunately you will grant other privileges as well, which are inherited in the database privilege, that you might not want to. For instance, if you grant DBADM, the user can also update, delete, insert all tables in that database, he can create new ones or drop tables and much more including utility-privileges.
Reply With Quote
  #3 (permalink)  
Old 02-20-04, 19:25
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: grant select ... ( or any other objects )

This is not possible as far as I know

You will have to grant at the table level

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #4 (permalink)  
Old 02-23-04, 12:59
dmmac dmmac is offline
Registered User
 
Join Date: Aug 2003
Location: Massachusetts, USA
Posts: 106
Re: grant select ... ( or any other objects )

You can build a SELECT statement that builds the GRANT statements:

SELECT CASE WHEN type = 'V'
THEN 'GRANT SELECT ON ' || RTRIM(creator) || '.' || name || ' TO groupa, groupb;'
WHEN name LIKE '%_T'
THEN 'GRANT SELECT, INSERT ON ' || RTRIM(creator) || '.' || name || ' TO groupa, groupb;'
ELSE 'GRANT INSERT, SELECT, UPDATE, REFERENCES ON ' || RTRIM(creator) || '.' || name || ' TO groupc, groupd;'
END
FROM sysibm.systables
WHERE (creator IN ('SCHEMA' )
AND type != 'A'
AND (name LIKE '%_T'
OR name LIKE '%_RT'
OR name LIKE '%_V'
OR name LIKE '%_AT'))


Quote:
Originally posted by bab
hi all,

how can i grant "select" on all tables in schema x to a user y without listing all names of tables in schema x ...

GRANT SELECT ON TABLE x.tab1 TO USER y;
GRANT SELECT ON TABLE x.tab2 TO USER y;
GRANT SELECT ON TABLE x.tab3 TO USER y;
GRANT SELECT ON TABLE x.tab4 TO USER y;
....
....
and so on ...


is there any commands like :

GRANT SELECT ON TABLE x.ALLTABLE TO USER y; ?????? !!!!

thanks a lot
Reply With Quote
  #5 (permalink)  
Old 02-24-04, 03:48
bab bab is offline
Registered User
 
Join Date: Feb 2004
Posts: 37
hi walter, sathyaram, dmmac

thanks for responses ..

another question:

what is the reason that i can change to a schema that not exists on DB ...

for example: set schema YYY

there is no schema YYY but i dont get any errors ... what is the reason?

thanks a lot

bab



@walter
hi walter, vielen dank für die antwort ...
Reply With Quote
  #6 (permalink)  
Old 02-24-04, 03:50
Walter Janissen Walter Janissen is offline
Registered User
 
Join Date: Nov 2003
Location: Germany
Posts: 62
I think, because you have SYSADM-authority.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On