图5
对象权限是一种对于特定的表、视图、序列、过程、函数或程序包执行特定操作的一种权限或权利。上表列出了各种对象的权限。需要注意的是适用于序列的权限只有SELECT 和ALTER。通过指定可更新列的子集可以对UPDATE、REFERENCES 和INSERT 权限加以限制。通过用列的子集创建视图并授予对于该视图的SELECT 权限,则可对SELECT 权限加以限制。对于同义词的授权会转换为对于该同义词所引用的基表的授权。 授予对象权限
GRANT { object_privilege [(column_list)]
[, object_privilege [(column_list)] ]...
|ALL [PRIVILEGES]}
ON [schema.]object
TO {user|role|PUBLIC}[, {user|role|PUBLIC} ]...
[WITH GRANT OPTION]
其中:
object_privilege:指定要授予的对象权限
column_list:指定表或视图列(只在授予INSERT、REFERENCES 或UPDATE 权限时才指定。)
ALL:将所有权限授予已被授予WITH GRANT OPTION 的对象
ON object:标识将要被授予权限的对象
WITH GRANT OPTION:使被授予者能够将对象权限授予其他用户或角色
使用GRANT 语句授予对象权限。
? 要授予权限,对象必须在自己的方案中(除非已被授予Grant any object privilege权限),或者已通过GRANT OPTION 被授予权限。
? 缺省情况下,如果拥有某个对象,则自动获得对该对象的所有权限。
? 若有安全方面的考虑,则将您的对象权限授予其他用户时应谨慎。 WITH GRANT OPTION clause
Specify WITH GRANT OPTION to enable the grantee to grant the object privileges to other users and roles. The user whose schema contains an object is automatically granted all associated object privileges with the GRANT OPTION. This special privilege allows the grantee several expanded privileges:
- The grantee can grant the object privilege to any users in the database, with or without the GRANT OPTION, or to any role in the database.
- If both of the following are true, the grantee can create views on the table and grant the corresponding privileges on the views to any user or role in the database:
- The grantee receives object privileges for the table with the GRANT OPTION.
- The grantee has the CREATE VIEW or CREATE ANY VIEW system privilege