实例用户 执行命令,并将结果重定向到 grant_select_to_dbaa.sql 文件中
db2 -x "select 'grant select on table '||trim(tabschema)||'.'||trim(tabname)||' to user dbaa;'
from syscat.tables where tabschema like 'SYS%'" |tee grant_select_to_dbaa.sql

实例用户 执行 db2 -tvf grant_select_to_dbaa.sql 进行赋权。
实例用户 执行命令,并将结果重定向到 grant_execute_to_dbaa.sql 文件中
db2 -x "select 'grant execute on function '||trim(funcschema)||'.'||trim(funcname)||' to user
dbaa;' from syscat.functions where funcschema like 'SYS%' and funcname not in
('>','<','ABSVAL','ABS','=','>=','<=','<>','ACOS')" |tee grant_execute_to_dbaa.sql

实例用户 执行 db2 -tvf grant_execute_to_dbaa.sql 进行赋权。
将实例配置参数中的 SYSMON_GROUP 设置为 DBAA 用户

db2 get dbm cfg|grep -i mon
实例用户执行命令 db2 update dbm cfg using SYSMON_GROUP dbaa;
重启实例生效:db2stop 、db2start
