How to grant select privileges on all tables for DB2

20 July,2011 by Tom Collins

Take these steps to generate SELECT privileges for a given USER on all tables in a SCHEMA

Either create a shell script and execute, or run from the command prompt

 

MYDB=""
MYSCHEMA=""
MYUSER=""
db2 "CONNECT TO $MYDB"
DBTABLES=`db2 -x "SELECT tabname FROM syscat.tables WHERE tabschema=UPPER('$MYSCHEMA')"`
for TABLENAME in $DBTABLES;
do db2 "GRANT SELECT ON $MYSCHEMA.$TABLENAME TO USER $MYUSER"
done
db2 "DISCONNECT $MYDB"

Read More

DBA Interview Questions and Answers – DB2 Security Management

DB2 - A Security Primer

DB2 security audit

Author: Rambler(http://www.dba-db2.com)

Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to grant select privileges on all tables for DB2

Comments are moderated, and will not appear until the author has approved them.


dba-db2.com | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright