[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
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