Oracle10g权限管理

本文详细介绍了Oracle数据库中用户管理的基本操作,包括用户的创建、删除、授权及权限撤销等过程。此外,还提供了角色管理的方法以及如何进行登录验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[b][size=medium]1、创建用户(默认只有sys和system用户有此权限)[/size][/b]
create user username identified by password;
[size=medium][b]2、删除用户[/b][/size]
drop user username;
[size=medium][b]3、用户授权[/b][/size]
[color=blue]a.授予权限[/color]
grant create session to username;(创建session的权限,即登录权限)
grant create table to username;(创建table的权限)
grant unlimited tablespace to username;(无限制使用表空间的权限)
[color=blue]b.撤销权限[/color]
revoke create session/table from username;
revoke unlimited tablespce from username;
[color=blue]c.查询用户权限(user_sys_privs为系统视图)[/color]
select * from user_sys_privs;
[size=medium][b]4、对象权限[/b][/size]
[color=blue]a.授予权限[/color]
grant select on table to username;(查询表的权限)
grant select on table to public;(将查询表的权限授予所有用户)
grant all on table to username;(将表的所有权限授予用户)
[color=blue]b.撤销权限[/color]
revoke insert on table from username;
revoke insert on table from public;
revoke all on table from username;
[color=blue]c.查询对象权限(user_tab_privs为系统视图)[/color]
select * from user_tab_privs;
[color=blue]d.将对象权限控制到列[/color]
grant update(id) on table to username;(更新表中id列的权限)
revoke update(id) on table from username;
[color=blue]e.查询对象的控制到列的权限(user_col_privs为系统视图)[/color]
select * from user_col_privs;
[color=red]注意:select,delete不能控制到列。[/color]
[color=blue]f、权限传递[/color]
grant alter on table to username width admin option;
[size=medium][b]5、角色管理[/b][/size]
[color=blue]a、创建角色[/color]
create role myrole;
[color=blue]b、删除角色[/color]
drop role myrole;
[color=blue]c、授予角色权限[/color]
grant create session to myrole;
grant create table to myrole;
grant unlimited tablespace to myrole;
[color=blue]d、授予用户角色[/color]
grant myrole to username;
[color=red]注意:有些系统权限无法直接授予角色,如unlimited tablespace。[/color]
[size=medium][b]6、登录验证机制[/b][/size]
[color=blue]a、验证顺序[/color]
操作系统验证——>密码文件验证——>数据库验证
[color=blue]b、修改普通用户密码[/color]
alter user username identified by password;
[color=blue]c、修改sys用户密码[/color]
在命令行输入以下命令:
orapwd file="E:\oracle\product\10.2.0\db_1\database\PWDorcl.ora" password=password entries=1 force=y
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值