Chinaunix首页 | 论坛 | 博客
  • 博客访问: 723784
  • 博文数量: 823
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5165
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-21 15:52
文章分类

全部博文(823)

文章存档

2011年(1)

2008年(822)

我的朋友

分类: LINUX

2008-08-21 17:38:38


创建用户hillary,密码为window的用户,默认的表空间是users,临时表空间是temp
createuserhillaryidentifiedbywindowdefaulttablespaceuserstemporarytablespacetemp;

删除用户
dropuseruser_name[cascade];#如果被删除的用户拥有对象,则需要使用cascade关键字

修改口令
alteruseruser_nameidentifiedbynew_password;
password;#仅能修改当前用户的口令

锁定/解锁用户
alteruseruser_nameaccount[lock|unlock];

修改默认表空间
alteruseruser_namedefaulttablespacenew_def_tablespace[temporarytablespacenew_temp_tablespace];

给用户相应权限
grantsystem_prifvilege[,system_privilege]touser_name[withadminoption];#withadminoption表示将要授予系统权限的用户
grantcreatesessiontohillary;#授予createsessionprivilege

查看当前系统用户信息
selectusername,passwordfromdba_users;

查看用户的系统权限
connectuser/password;
select*fromuser_sys_privs;

回收系统权限
revokesystem_privilege[,system_privilege]fromuser_name

为用户授予对象权限
grantobject_privilege[(column_name)]onobject_nametouser_name[withgrantoption]
#object_privilege表示对象权限,column_name表示对象中的列名称,object_name表示指定的对象名称,withgrantoption允许该用户将当前的对象权限转授予其他用户.
例:(1)为hillary用户授予对scott.authors表的select/insert/delete的对象权限.命令如下
connectscott/password;
grantselect,insert,deleteonscott.authorstohillary[withgrantoption];
(2)为hillary授予对scott.authors表中first_name和phone列的更新权限.
connectscott/password;
grantupdate(first_name,,phone)onscott.authorstohillary;
回收授予的对象权限
revokeobject_privilegeonobject_namefromuser_name
connectscott/password;revokeselect,insertonscott.authorsfromhillary;

角色创建/查看角色信息
createrolerole_name[identifiedbyrole_password];
select*fromuser_role_privs; 下载本文示例代码
阅读(100) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~