目前我遇到的是在linux环境下,db2 10.5fp5对于从oracle迁移过来的数据库中的对象赋权问题,多次尝试部分成功,但一旦function包含变量,就有问题了,在revoke过程中,再次出现问题,包括前面赋权成功的也会报错。
------------分割线,以下是DB2的回答------------
这个问题在V10.5 FP7由APAR IT07092(https://www-01.ibm.com/support/docview.wss?uid=swg1IT07092) 修复了。 从v10.5 FP7开始, 用户在grant的时候就会报SQL20078N错。
由于grant就会失败,所以也就不会有revoke 导致-901的问题。 注意, APAR里面有这么一句话:
In retrospect, the ability to GRANT and REVOKE privileges from
routines within an oracle module does not really make sense, and
instead privileges should be GRANTED and REVOKED only to the
module itself.
就是说, 对于在module里面的function, 只支持对module的 grant 和 revoke, 对module里面的function, 不支持grant / revoke.
这个文档:https://www.ibm.com/support/knowledgecenter/en/SSEPGG_10.5.0/com.ibm.db2.luw.sql.ref.doc/doc/r0007699.html
Privileges for a routine defined in a module are granted at the module level using the GRANT (module privileges) statement. The EXECUTE privilege on the module allows access to all objects in the module.
对于当前已经grant成功的权限, 只能通过重建module;
或者重建function去掉:
收起