id xxx 

sudo su - xxxx 

date 

db2 list db directory 

db2 connect to xxxxx 

db2 "select * from syscat.dbauth where grantee = 'xxx'" |tr -s " " 

db2 "select * from syscat.tabauth where grantee = 'xxx'" |tr -s " " 

db2 "REVOKE CONNECT ON DATABASE FROM USER xxx" 

db2 "select * from syscat.dbauth where grantee = 'xxx'" |tr -s " " 





for TABLE in `db2 connect to xxxx> /dev/null;  

db2 -x "select * from syscat.tabauth where grantee='xxx'"| awk '{print "\""$5"\"""."$6}'`;do 

db2 revoke select on table $TABLE from user xxx 

done 


db2 "select * from syscat.tabauth where grantee = 'xxx'" |tr -s " " 

db2 terminate 
date
注意查询语句里的用户id是大写