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 permission on tables to public

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-17-11, 10:58
navch navch is offline
Registered User
 
Join Date: Jan 2010
Posts: 19
grant permission on tables to public

Hi,

I am trying to grant permission to all the tables in a particular schema. There are more than 100 tables in that schema and I do not want to type the grant statement for every table like

grant select on table1 to public;
grant select on table2 to public;
....
....

I tried to use the following statement.

select 'grant select on',tabname,' to public' from syscat.tables where tabschema='ABC'

This statement creates the select grant statements but does not grant permission. If I use this statement, then I have to export the output to a text file and then execute that text file which I do not want.

I am using DB2 command editor and I do not want to use Linux shell utility.

Can someone please help.

Thanks in advance.

Nav
Reply With Quote
  #2 (permalink)  
Old 03-17-11, 11:21
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Unfortunately there is not much we can do to help you. You have stated the only options that will allow you to do what you want.

Andy
Reply With Quote
  #3 (permalink)  
Old 03-17-11, 11:24
navch navch is offline
Registered User
 
Join Date: Jan 2010
Posts: 19
Ok, if it can not be done in one statement using command editor then how should it be done using other platforms.

Nav
Reply With Quote
  #4 (permalink)  
Old 03-17-11, 11:29
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You can do it either of the two ways you mentioned. Use a select statement to generate a script that will do it and then run that script, or use a linux script to do the same thing.


Andy
Reply With Quote
  #5 (permalink)  
Old 03-17-11, 11:59
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
navch, If you use Control Center, you can do this.

Expand User and Group objects under the database.
Click on Groups.
Right click on Public and select Change.
Click on the Table tab.
Click on Add Table.
Enter or Select a Schema.
Highlight all the tables (CNTL+A if you want everything) and click Ok.
Highlight all the tables (Click the first one, hold SHIFT key down and click the last one).
Change the Select Drop down box to Yes.
Click OK.
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