现在的位置: 首页 > 综合 > 正文

【Oracle】用户管理

2012年08月02日 ⁄ 综合 ⁄ 共 1115字 ⁄ 字号 评论关闭

create user hywin identified by hywin; 创建用户

password 用户名  修改密码
alter user 用户名 identified by 新密码
drop user 用户名 [cascade]; 删除用户时,如用户已经创建了表,那么就需要在删除时带一个参数cascade。

grant connect to 用户名; 为某用户名授连接数据库的权限。connect为一种角色。

revoke select on emp from hywin; 收回hywin查询emp表的权限。

权限:

1系统权限(约140种)
用户对数据库的相关权限,建库、建表、修改密码等权限。create session

2对象权限(约25种)
用户对其他用户的数据对象操作的权限。(数据对象:表、视图、索引、触发器等)
select insert update delete all

grant select on emp to hywin; 为hywin授权可查询emp表。
select * from scott.emp;方案

角色:

1预定义角色
2自定义角色

connect 里面有7种权限。
dba 管理员角色
resource 可在任何一个表空间建表

desc 表名; 查看表结构

权限的维护
对象权限:后缀with grant option
grant select on emp to hywin with grant option;

系统权限:后缀with admin option
grant select on emp to hywin with admin option;

多级授权后收去中间用户的某些权限则此中间用户之前所授给其他用户的权限同时收回。

口令管理
profile

scott用户最多尝试三次登录,之后锁定2天。
create profile lock_account limit failed_login_attempts 3 password_lock_time 2; --lock_account 规则名称

alter user scott profile lock_account;

给用户解锁
alter user scott account unlock;

中止口令
create profile myprofile limit password_life_time 10 password_grace_time 2;十天修改一次密码,宽限两天。

alter user scott profile myprofile;

口令历史
create profile password_history limit password_life_time 10 password_grace_time 2 password_reuse_time 10;十天后可重用

删除profile
drop profile password_history [cascade]

抱歉!评论已关闭.