设为首页
加入收藏夹

Oracle环境的安全性
浏览选项:

  (1)用户
 如:create user spgroup identified by spgroup
default tablespace data
temporary tablespace temp
quota 20k on system;
quota unlimited on data;
grant create session to spgroup;//此用户可使用,必须被授予create
 创建Oracle用户时,若不指定缺省的表空间,Oracle就会将system表空间作为其存储
  临时表空间时新用户创建临时段的位置,所有用户的临时段应建在一个单独的表空间中,
以避免在其他表空间造成空闲空间碎片。
 配额可以指定用户在哪个表空间用有配额。分配给该用户的存储空间可存储任何类型
的数据库对象。用来创建临时段的表空间不需要配额。
 select * from dba_ts_quotas where username='FLOWER';查看分配给用户的配额。
 alter user fowler identified by price;//改用户名
 alter user fowler quota 0 on user_data;//阻止fowler用户再使用数据库中的//
 drop user bradley1;//若用户下不包含对象
 drop user bradley cascade;//若用户下包含对象,必须加cascade,将删除所有用户
下对象,//但不会删除其他模式的对象,如基于删除用户模式的对象的同义词、视图、存储过
 (2)权限
 1、系统级权限
 grant create table to permjit; 
 grant create table to permjit with admin option;
 grant create any table to permjit;//any可以使一oracle用户创建其他任何用户
 grant create table to public;//public表示数据库的所有的用户
 revoke create table from permjit,fowler;

 revoke create table from public;//直接授予的系统权限不受影响
 select * from dba_sys_privs where grantee='SPGROUP';//若系统权限是直接授予
  //直接授予的系统权限指不是通过role和public授予的,而直接显示被授予的
 2、对象级权限
 grant Select on spgroup.STAFF_FUNC to csp_connect ;
 grant Select on spgroup.STAFF_FUNC to role_user ;
 grant execute on spgroup.sosp_addr_i to role_user;
 //使用execute权限,存储过程在被调用时,该过程在其属主的用户内部执行,和其
属主的用户调用效果一样,影响并使用表和其他对象,因此不用授予存储过程使用的相关表的
 alter,index,references的权限不常用。
 grant all on spgroup.so to fzbase;//赋所有的对象级权限。
 grant Select on spgroup.STAFF_FUNC to csp_connect with grant option;
 //使被授权的Oracle用户再将这种对象级权限授予另外的用户。
 查看对象级权限:
 select * from table_privileges where GRANTEE='CSP_CONNECT';
 **** select * from table_privileges where GRANTEE='PUBLIC';
 //table_privileges显示用户拥有的所有的对象级权限列表,column_privileges显示
用户拥有的所有的列级权限列表。(不论是直接授予还是通过角色授予的)
 一个oracle用户的权限包括直接授予该用户的权限,授予public用户的权限和授予用
户所具有的角色的权限,这些角色必须是允许的。
 (3)角色
 授权与回收与权限一致,也可使用public;
 set role;禁止角色。
 set role all;打开所有的角色
 set role all except salesperson;
 set role manager;只打开角色manager
 查看角色:
 select * from dba_roles;//数据库中的所有角色的名字
 select * from dba_role_privs where grantee='FZBASE';//哪个用户具有哪个角色
 select * from role_sys_privs;//角色的系统级权限
 角色的对象级的权限不放在role_table_privs而在
 select * from table_privileges where grantee='ROLEUSER';(Oracle 8的变化)
 角色的缺点:
 如果对象的权限是通过角色获得的,则不能在其上创建过程化对象(过程、函数、包
)。



Copyright © 2004 wanxu.com All Rights Reserved