The NoteBook of EricKong

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  611 Posts :: 1 Stories :: 190 Comments :: 0 Trackbacks
1.查询Oracle所有系统权限 
 
select * from system_privilege_map   
2.查询Oracle所有对象权限 
 
select * from table_privilege_map   
3.将'授予系统权限'这个权限给某用户--当然一般采用 dba 给其他用户授予“其他权限”,这个权限一般不需要给别人 
 
grant any privilege to TestUser 【with admin option】//表示 TestUser 用户有权利 给其他用户授予 系统权限 。后面 表示对这个权限的维护(能否再授予其他用户)   
4.举例: 授予系统权限 create session (连接数据库的关键权限,connect角色中有这个权限,oracle角色 文章中有介绍) 
 
1.grant create session to TestUser //TestUser就可以连接数据库了  
2.grant create session to TestUser with option admin //TestUser就可以连接数据库了,并且 可以 将这个权限 给其他用户  
5.收回 系统权限 不会级联回收 
 
revoke create session from TestUser  
6.关于 系统权限 的维护 
 
with admin option //表示继承后可以 授予其他用户  
7.关于 对象权限 的维护 
 
with grant option //表示继承后可以 授予其他用户  
8.举例: 授予对象权限 update,select,insert,delete,all [4种等于 all] 
 
grant select on scott.emp to TestUser 【with grant option】 //表示给TestUser 授予scott.emp的查询权限  
grant all on scott.emp to TestUser //表示给TestUser 授予scott.emp的select,update,insert,delete 权限  
9.举例: 授予 某几列 对象权限 
 
grant update on scott.emp(sal) to luob //指定修改某列  
grant select on emp(ename,sal) to luob //只能查询这指定字段  
10.举例:授予 alter 权限 
 
grant alter on scott.emp to luob //授予这个表结构的修改权限  
11.举例:授予 execute 权限 (用于用户执行其他方案的包、过程,函数) 
 
grant execute on dbms_transaction to luob; --执行 dbms_transaction 包的权限  
12.举例:授予 index 权限 
 
grant index on scott.emp to luob 【with grant option】 //授予创建索引的权限  
13.收回 对象权限 【cascade】会级联回收 
 
revoke select on scott.emp from TestUser【cascade】//撤销查询权限或者级联撤销  
14.举例:级联回收的 
 
grant select on emp to luobing with grant option; //授予权限 并维护  
conn luobin/m123@ORACLE; //登录后 给 xiaoming 权限  
grant select on emp to xiaoming;  
conn scott/tiger@ORACLE //scott 撤销 luobing的权限  
revoke select on emp from luobing cascade  
conn xiaoming/m123@ORACLE;  
select * from scott.emp; //表和视图不存在  
15.查询当前用户具有的系统权限 
 
select * from dba_sys_privs where grantee='SYSTEM'  
16.查询当前用户具有的对象权限 
 
select * from dba_tab_privs where grantee='SYSTEM';  
17.查询当前用户具有的列权限 
 
select * from dba_col_privs where grantee='SYSTEM';  
18.查询用户 SCOTT 所拥有的系统权限 
 
select * from dba_sys_privs where grantee in (select granted_role from dba_role_privs where grantee='SCOTT');  
19.数据库管理员 DBA的一些职责 
 
1.安装和升级 oracle 数据库  
2.建库建表建空间 视图,索引。。。。  
3.指定和并实施 备份和恢复计划  
4.数据库权限管理,调优,故障排除  
5.对高级的dba,要求能参加项目开发,会编写sql语句 ,存储过程,触发器,规则,约束,包  
6.管理员 还有管理初始化参数  
     show  parameter; 有 200多参数 有参数可以配置的  
7.管理数据库的用户主要是 sys (董事长)> 和system  (总经理)  
20.sys,sysdba,sysoper的区别 
 
sys:拥有oracle的基表和视图,拥有 dba 数据库管理  
sysdba:系统管理员  
sysoper:系统操作员  的角色和权限  
system:主要存储次一级的数据 如:oracle的特性和工具的管理信息和   
dba,sysdba 角色权限 区别     
1.存储的数据重要性不一样 ,权限不一样   
2.sys 必须 利用 as sysdba 或者 as sysoper 不能用normal(标准)方式登录  
3.system 默认登录角色是  dba   (conn system/manager)  
4.如果用  conn system/manager as sysdba  登录结果和 sys 登录一样  
21. sysdba 和 sysoper的权限区别 
权限sysdbasysoper
能够 Startup/Shutdown 启动/关闭数据库yy
alter database open/mount/backup(设置数据库不同的状态)yy
改变字符集yn
采用 create/drop database(创建/删除数据库)yn
create spfileyy
alter database archivelog(归档日志)yy
alter database recover(完全和部分恢复数据库)y只能完全恢复,不能执行部分恢复
拥有 restricted session(会话限制)权限yy
可以让用户作为sys 用户连接yy
登录之后syspublic
posted on 2013-10-08 11:51 Eric_jiang 阅读(223) 评论(0)  编辑  收藏 所属分类: 数据库

只有注册用户登录后才能发表评论。


网站导航: