一、批量生成所有要授权的表/视图/函数
--表的权限
select 'grant select, insert, update on '+t.name+' to techuser;' from sys.all_objects t where t.schema_id = 1 and t.type in ('U');--视图权限
select 'grant select '+t.name+' to techuser;' from sys.all_objects t where t.schema_id = 1 and t.type in ('V');
--函数权限
select 'grant execute on '+t.name+' to techuser;' from sys.all_objects t where t.schema_id = 1 and t.type in ('FN');
二、执行第一步批量生成的脚本
三、当表/视图/函数据有新增时,需要生新执行第一、二步
四、改写成存储过程,执行存储过程,自动执行第一、二步,完成授权(等完成)