一、用户管理与应用
1、查看用户与模式
select * from dba_users; select * from all_users; select * from user_users;
2、创建用户TEST
connect system/passward create user test //名 identified by test //密码 /
3、给予新用户基本权限 create session , resource, create any table
grant create seesion, dba to test;
4、调整用户的密码、锁定状态、配额等
connect system/passward //新建用户TEST1 creste user test1 identified by test1 //授权 grant create seesion, resource to test1; //密码由test1改为password connect test1/test1 alter user test1 identified by passward //锁定 connect scott/passward connect system/passward alter user scott account lock; //scott be locked //解锁 connect system/passward alter user scott account unlock; //修改表空间 connect system/passward select tablespace_name,contents form dba_tablespace; //把test1的默认空间设置为users 临时设置为temp alter users test1 default tablespace users temporary tablespace temp //修改配额 connect system/passward create user test3 identified by test3; grant create session,create table to test3; //将SYSAUX中的配额分一部分给user connect system/passward alter user test3 default tablespace sysaux quota 10M on sysaux
5、删除用户!!
connect system/passward drop user test3 cascade
二、权限管理与应用
系统权限system privilege
对象权限object privilege on objectName
1、授予或回收系统权限
授予
grant system_privilege to username;
回收
revoke system_privilege from username;
//system_privilege 表示系统权限 如:create session/sequence/table/synonym
2、授予或回收对象权限
授予
grant object_privilege on object_name to username;
回收
revoke object_privilege on object_name from username;
三、角色管理与应用
role 一系列权限的命名集合,目的是简化权限管理的复杂性
1、创建角色
connect system/passward create role role_name(例如T1) create role role_name identified by role_password;
2、将各类权限放入角色
grant select,insert,update on table_name to role_name;
3、将角色授予某用户
grant role_name to user grant role_name to role_name
本站由以下主机服务商提供服务支持:
0条评论