--创建授权脚本 grantread.sh
DB=$1
DB_USER=$2
DB_PWD=$3
db2 connect to $DB user $DB_USER using $DB_PWD
db2 "select 'grant select on table ' || rtrim(tabschema) || '.' || tabname || ' to testuser_1; '
from syscat.tables
where tabschema='$DB_USER' " > readauthdb.sql
grep grant readauthdb.sql > read_auth.sql
db2 -tvf read_auth.sql
DB=$1
DB_USER=$2
DB_PWD=$3
db2 connect to $DB user $DB_USER using $DB_PWD
db2 "select 'grant select on table ' || rtrim(tabschema) || '.' || tabname || ' to testuser_1; '
from syscat.tables
where tabschema='$DB_USER' " > readauthdb.sql
grep grant readauthdb.sql > read_auth.sql
db2 -tvf read_auth.sql
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22661144/viewspace-1477192/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22661144/viewspace-1477192/