oracle的用户管理
每个oracle数据库都有许多合法用户,这些用户可以根据用户名和口令登录数据库,并使用sql语言存取数据。
(1) 创建用户
创建用户命令格式 说 明
create user 用户名; 创建用户的操作必须由dba来做,一般用户无权创建用户。用户名必须是唯一的,即同一数据库中不能有两个相同的用户。
identified by 口令; 为用户设置口令
default tablespace 表空间名; 表示该用户存放数据的缺省表空间
temporary tablespace 表空间名; 表明用户使用的缺省临时表空间名
quota 大小 on 表空间名; quota 可以限制用户在某个表空间上最多可使用多少字节
profile 资源文件; profile 为用户指定各种资源的使用
下面是一个创建用户的完整例子:
create user scott;
identified by tiger;
default tablespace data_ts;
temporary tablespace temp_ts;
quota 500k on data_ts;
profile newprofile;
(2) 修改用户
对用户的修改包括:口令字、缺省表空间、临时表空间、表空间限量、profile、缺省角色。角色是oracle7的一个新概念,我们在“权限管理”里再讨论。在这里可把角色看成具有某些权限的一个特殊用户。修改用户的缺省角色也就是为用户指明另一个权限的集合。下面举例说明修改用户的操作:
任 务 命 令
将scott的口令改为hello alter user scott identified by hello;
将scott的缺省表空间改为data2_ts alter user scott default tablespace data2_ts;
将scott的临时表空间修改为temp2_ts alter user scott temporary tablespace temp2_ts;
将scott的资源文件改为otherprofile alter user scott profile otherprofile;
将scott的缺省角色改为developer alter user scott default role developer;
将当前系统所有角色都授予scott,除payroll外 alter user scott default role all except payroll;
(3) 删除用户
删除用户的命令为:
drop user 用户名 [cascade];
若不使用cascade选项,则必须在该用户的所有实体都删除之后,才能删除该用户。使用cascade后,则不论用户实体有多大,都一并删除。
以上就是oracle的用户管理的内容。